ColorHighlighter icon indicating copy to clipboard operation
ColorHighlighter copied to clipboard

JS Color Vars

Open bluetidepro opened this issue 7 years ago • 3 comments

It doesn't seem like it works to highlight colors in JS when they are a exported var.

I added my color.js file to color_variables_files. The color.js file looks like this:

export default {
  WHITE: '#fff',
  GRAY1: '#f3f4f4',
  GRAY2: '#e8eaea',
  GRAY3: '#dee1e1',
  GRAY4: '#d3d6d7',
  GRAY5: '#c8cccc',
  GRAY6: '#b0b6b7',
  GRAY7: '#929a9b',
};

Then in a JS file, if I do something like this, no color is highlighted:

import Colors from 'bambu-colors';
...
Colors.GRAY2

Does this not work with JS or is there a way to set it up to work in JS? It would be awesome for those of who use JS inline styles to see the color show up as javascript variables.

bluetidepro avatar Nov 16 '16 17:11 bluetidepro

And for the record, the hex colors in the color.js file do work. It just doesn't seem to be able to import those into other files using the color_variables_files project array.

bluetidepro avatar Nov 16 '16 17:11 bluetidepro

I dont think the package was intended to work this way (across files via import/exporting).

sgnl avatar Dec 20 '16 00:12 sgnl

@sgnl I believe that's correct, that it only looks in the current file to recognize colors at the moment.

davmillar avatar Jun 02 '17 19:06 davmillar