galex / name-that-color-intellij-plugin

This plugin lets you insert a name for a color you copy-paste or type in an android resource file.
172 stars 23 forks source link

Make plugin work with other Jetbrains IDEs (not just Android Studio) #18

Open Potherca opened 4 years ago

Potherca commented 4 years ago

I love http://chir.ag/projects/name-that-color and this plugin could be awesome... sadly I am not using Android Studio but PHPStorm, so I can't use it :sob:

I have no idea how much work it will be, but would it be possible to create a version of this plugin that works with other IDEs, not just Android Studio?

galex commented 4 years ago

Hello @Potherca ,

Sounds doable! All this plugin does to target Android is to add "triggers" in an xml file containing <resources></resources> tags.

On what platform/language are you working on and how are colors defined in your project?

Potherca commented 4 years ago

I use PHPStorm (WebStorm is similar). Colors occur mostly in CSS, Sass (CSS) or Less files. They occur as values to keys like:

color: #00FF00;

There is all sorts of functionality related to color in CSS files (and similar) but no way (that I know of) to add/convert to "name that color".

galex commented 4 years ago

Can you show me an example of how you define and use named colors in css?

galex commented 4 years ago

Ping @Potherca :)

Potherca commented 4 years ago

Sorry about the delay, with the whole Corona thing going on and changing jobs to join @pdsinterop, this got shuffled to the bottom of the deck.

CSS defines values for properties, for instance, if I want an HTML page to be red with white letters, I would define:

    body {
        color: #FFF;
        background-color: #F00;
    }

Instead of #F00 I could also use rgb(255, 0, 0);, hsl(0, 100%, 50%); or simply red.

All available colors are listed at MDN

There is a UI element in PHPStorm that provides some functionality:

phpstorm

(Image taken from the PHPStorm manual entry on stylesheets)

Changing jobs also meant changing laptops. Currently I am working mostly in Cloud9 IDE and VSCode.

As soon as I have PHPStorm installed and set up, I could add some examples and screenshots for futher clarity if needed...