mattbierner / vscode-color-info

VSCode Extension that provides additional information about css colors
https://marketplace.visualstudio.com/items?itemName=bierner.color-info
MIT License
42 stars 10 forks source link

enable color info for js file as well? Since I use styled components loading customer js variable with color name. #15

Open adamchenwei opened 6 years ago

adamchenwei commented 6 years ago

is that possible?

arpitjacob commented 6 years ago

Looking for the same

wayncheng commented 6 years ago

Adding the following code to colorInfo.languages in settings.json should do the trick. Make sure to include all the default languages as well so they aren't disabled.

{
    "selector": "javascript",
    "colors": "css"
}

So your settings.json should look something like this:

"colorInfo.languages": [
    {
        "selector": "css",
        "colors": "css"
    },
    {
        "selector": "sass",
        "colors": "css"
    },
    {
        "selector": "scss",
        "colors": "css"
    },
    {
        "selector": "less",
        "colors": "css"
    },
    {
        "selector": "html",
        "colors": "css"
    },
    {
        "selector": "javascript",
        "colors": "css"
    }
]
JuneSites commented 5 years ago

This gives me a different pop up. No color picker. Also, I added PHP to the settings but it does not work at all.

lacivert commented 5 years ago

@wayncheng thanks, I tried 'js' as selector but as you stated, it must be 'javascript'. But still, it doesn't show the color as a box on the same line as the color code

wayncheng commented 5 years ago

@lacivert @EasyProWebTools hmm that's odd. Maybe some other editor hover setting or tooltip setting is causing a conflict.

JuneSites commented 5 years ago

@wayncheng For html and css files, hovering over the hex code, gives me an actual color picker with all the other formats and info below, and hovering over the little inserted color box gives me just the info (no color picker). For javascript files - no little color box inserted into code, and hovering over the hex code gives me just the info box (no color picker). For PHP files, not working at all, just says "Loading...". Here is a link to my screenshots: http://www.e33x.com/-test7p/index.php?page=8 Please help. I love this awesome extension but I work mostly in PHP files so I can't really use it most of the time.

JuneSites commented 5 years ago

OK realized another PHP extension was interfering. Now PHP files act just like javascript files - no little color box, and hovering over hex gives popup of just the color info (no color picker). What can we do to make the little color box and color pick show up always?

wayncheng commented 5 years ago

@EasyProWebTools I don't think this extension includes a color picker, just the info.

Roshdy commented 4 years ago

@lacivert @EasyProWebTools hmm that's odd. Maybe some other editor hover setting or tooltip setting is causing a conflict.

the hover is working fine for "javascript". But the color box doesn't show. Example: colors = { red: "#ff0000", white: "#fff" };

wayncheng commented 4 years ago

@Roshdy So the tooltip and the text info inside is visible, but the actual preview of the color isn't?

this-fifo commented 3 years ago

@wayncheng I believe what @Roshdy is referring to is the same as what was described in https://github.com/mattbierner/vscode-color-info/issues/12#issuecomment-370178964

Same happens for me, I can hover and see the info on .ts .tsx .js .jsx files after configuring the selectors for these languages but I can't see the handy box that would save me from having to use the mouse

death14stroke commented 3 years ago

@this-fifo have you found any way to show little color box in javascript files for react native?

this-fifo commented 3 years ago

@this-fifo have you found any way to show little color box in javascript files for react native?

I haven't, only thing that works for me on js files is the hovering but not the colour box

Spenhouet commented 2 years ago

I was trying to use this extension to show colors in yaml files by adding:

       {
            "selector": "yaml",
            "colors": "css"
        },
        {
            "selector": "yml",
            "colors": "css"
        }

but experience the same issue that I only get the box on hover but not the little color square.

hamudeshahin commented 1 year ago

Any solution for tsx and jsx files ???

alainib commented 1 year ago

@hamudeshahin it work with js and tsx files too (with react/reactnative) https://github.com/mattbierner/vscode-color-info/issues/11

NoHop3 commented 1 year ago

Any future plans for enabling the little color box? Currently only hover works for js/ts/tsx files still

grempa commented 1 year ago

I'm also hoping for the little colorbox left of the value in js files (should be like it is in css files)