Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make colorpickercontrol refer to default color scheme #6031

Merged
merged 1 commit into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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