breizh24 commented on issue #5420: Superset how to support custom add Color Scheme? URL: https://github.com/apache/incubator-superset/issues/5420#issuecomment-527380844 @ilyakam To add custom schemes, in case of a "Categorical Scheme" you need to import the CategoricalScheme class from the module "@superset-ui/color", here is an example: ```javascript import { CategoricalScheme } from '@superset-ui/color'; const schemes = [ { id: 'testColors', label: 'Test Colors', colors: ['#2d51a3', '#7d7f82', '#2061e0', '000000'], }, ].map(s => new CategoricalScheme(s)); export default schemes; ``` then you need to import this into /superset/assets/src/setup/setupColors.js and add it to the already existing schemes, you should end up with something like this: ```javascript import testColors from '../myColors/myColorSchemes'; export default function setupColors() { // Register color schemes const categoricalSchemeRegistry = getCategoricalSchemeRegistry(); [airbnb, categoricalD3, google, lyft, testColors].forEach((group) => { group.forEach((scheme) => { categoricalSchemeRegistry.registerValue(scheme.id, scheme); }); }); categoricalSchemeRegistry.setDefaultKey('bnbColors'); ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org