superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [incubator-superset] branch big-number-color updated: remove rgbToHex reference
Date Wed, 22 Aug 2018 01:09:18 GMT
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch big-number-color
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/big-number-color by this push:
     new 23a07ab  remove rgbToHex reference
23a07ab is described below

commit 23a07abdff701584ffd16e1adba5d67eddf7bb2b
Author: Hugh Miles <hmiles@lyft.com>
AuthorDate: Tue Aug 21 18:09:07 2018 -0700

    remove rgbToHex reference
---
 superset/assets/src/modules/colors.js            | 9 +++++++++
 superset/assets/src/visualizations/BigNumber.jsx | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/superset/assets/src/modules/colors.js b/superset/assets/src/modules/colors.js
index 0bb3221..be913ee 100644
--- a/superset/assets/src/modules/colors.js
+++ b/superset/assets/src/modules/colors.js
@@ -593,3 +593,12 @@ export function hexToRGB(hex, alpha = 255) {
   const b = parseInt(hex.slice(5, 7), 16);
   return [r, g, b, alpha];
 }
+
+
+export const rgbToHex = function (color) {
+    console.log(color);
+    return (color && Object.keys(color).length === 4) ?
+           '#' + ('0' + parseInt(color.r, 10).toString(16)).slice(-2) +
+          ('0' + parseInt(color.g, 10).toString(16)).slice(-2) +
+          ('0' + parseInt(color.b, 10).toString(16)).slice(-2) : '';
+};
diff --git a/superset/assets/src/visualizations/BigNumber.jsx b/superset/assets/src/visualizations/BigNumber.jsx
index d5b2b50..3b777ff 100644
--- a/superset/assets/src/visualizations/BigNumber.jsx
+++ b/superset/assets/src/visualizations/BigNumber.jsx
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
 import ReactDOM from 'react-dom';
 import { XYChart, AreaSeries, CrossHair, LinearGradient } from '@data-ui/xy-chart';
 
-import { brandColor, rgbToHex } from '../modules/colors';
+import { brandColor } from '../modules/colors';
 import { d3FormatPreset } from '../modules/utils';
 import { formatDateVerbose } from '../modules/dates';
 import { computeMaxFontSize } from '../modules/visUtils';


Mime
View raw message