Skip to content

Commit

Permalink
refer to default color scheme in colorpickercontrol instead of pointi…
Browse files Browse the repository at this point in the history
…ng to specific scheme (apache#6031)
  • Loading branch information
kristw authored and betodealmeida committed Oct 12, 2018
1 parent 0ebfc19 commit e13636a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SketchPicker } from 'react-color';
import ColorPickerControl from
'../../../../src/explore/components/controls/ColorPickerControl';
import ControlHeader from '../../../../src/explore/components/ControlHeader';
import { registerScheme } from '../../../../src/modules/ColorSchemeManager';

const defaultProps = {
value: { },
Expand All @@ -17,6 +18,8 @@ describe('ColorPickerControl', () => {
let wrapper;
let inst;
beforeEach(() => {
registerScheme('test', ['red', 'green', 'blue'])
.setDefaultSchemeName('test');
wrapper = shallow(<ColorPickerControl {...defaultProps} />);
inst = wrapper.instance();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { OverlayTrigger, Popover } from 'react-bootstrap';
import { SketchPicker } from 'react-color';

import ControlHeader from '../ControlHeader';
import { bnbColors } from '../../../modules/colors';
import { getScheme } from '../../../modules/ColorSchemeManager';

const propTypes = {
onChange: PropTypes.func,
Expand Down Expand Up @@ -59,7 +58,7 @@ export default class ColorPickerControl extends React.Component {
<SketchPicker
color={this.props.value}
onChange={this.onChange}
presetColors={bnbColors.filter((s, i) => i < 7)}
presetColors={getScheme().filter((s, i) => i < 7)}
/>
</Popover>);
}
Expand Down
4 changes: 0 additions & 4 deletions superset/assets/src/modules/colors.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import d3 from 'd3';
import sequentialSchemes from './colorSchemes/sequential';
import airbnb from './colorSchemes/airbnb';
import lyft from './colorSchemes/lyft';

export const brandColor = '#00A699';
export const colorPrimary = { r: 0, g: 122, b: 135, a: 1 };
export const bnbColors = airbnb.bnbColors;
export const lyftColors = lyft.lyftColors;

export function hexToRGB(hex, alpha = 255) {
if (!hex) {
Expand Down

0 comments on commit e13636a

Please sign in to comment.