Coder Social home page Coder Social logo

vscolors's Introduction

Its my first extension! Leave a rating and share your thoughts on it to help me learn and understand your expectations.

If you have any questions or recommandations, please feel free to contact me at @kevscript.

Features

VSColors is a VS Code extension helping you with color type conversions. It handles basic HEX, RGB and HSL colors, alongside their Alpha formats for opacity.

How it Works

Highlight your color, and right-click it. You should see options to convert your colors in the navigation.

how it works

Extension Settings

This extension contributes the following settings:

  • vscolors.color2Hex: converts highlighted color to a HEX value
  • vscolors.color2Rgb: converts highlighted color to an RGB value
  • vscolors.color2Hsl: converts highlighted color to an HSL value

Additional Informations

Extension doesn't handle implicit alpha values.

For example rgba(255, 255, 0) will yield an error as RGBA format expects an alpha value.

Others

Check VSColors on the MarketPlace.

vscolors's People

Contributors

kevscript avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

vscolors's Issues

Convert HEX without '#'

Hey @kevscript, how are you?
Great extension, it's the only color format converter
that really worked perfectly for me.

I'm having a bit of trouble with HEX colors.
When you double click a text to select the color to convert,
VS Code does not include the hashtag character.

Example:

Double click the string:

"#C9533E",

Right click, convert to RGB:

image

Do you think it would be possible to:
remove the '#' character from the regex,
when converting back, replace the selection + 1 character to the left?

Since 'rgb' and 'hsl' both have the name strings before,
it's very distinguishable from HEX colors, it could work.

If you think it's a good idea or there's a better solution, let me know and I can PR it. =)

Add support for modern colour formats

When I highlight rgba(10 10 10 / 10%), right-click, and choose "Color to HSL", I get an error saying "Can't resolve color format of rgba(10 10 10 / 10%)".

I have to change it to the legacy format rgba(10, 10, 10, 0.1), at which point I can convert it. It generates hsla(0, 0%, 4%, 0.1), which is also the legacy format.

But this generates a Stylelint violation "Expected 0.1 to be 10% (alpha-value-notation)". If I make that change, I get "Expected modern color-function notation (color-function-notation)".

Stylelint is expecting the modern format: hsla(0deg 0% 4% / 10%); examples are at the link above. (It appears that the deg is required by a separate rule: hue-degree-notation.)

Would it be possible for the extension to:

  1. read the modern formats, and
  2. have an option to write colours in the modern formats rather than the legacy ones? (It would probably be a good idea to have a second option to control whether to use deg in angles, too.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.