GithubHelp home page GithubHelp logo

thedutchcoder / colorconvert Goto Github PK

View Code? Open in Web Editor NEW
55.0 55.0 6.0 234 KB

A Sublime Text 2 plugin that converts CSS colors from hex to rgb and back

License: MIT License

Python 92.12% JavaScript 7.88%

colorconvert's People

Contributors

garrypolley avatar kusamakura avatar oliverseal avatar thedutchcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

colorconvert's Issues

convert just only having the cursor over the color

The problem is: I have to select completely the color for then execute the key binding. I could see in other plugins like "Hex-to-RGBA" that staying the cursor over the color it is possible to execute the key binding but here it doesn't work.

BUG: Opacity Gets 'Stuck' when coverting subsequent HEX values

If I first convert an RGBA or an HSLA to a HEX, and then go and mess with a different line entirely... the original A value from the first line gets applied to the second line. The value gets 'stuck'.

e.g. Convert both lines to HSLA in order:

box-shadow: inset 0 3px 9px rgba(0,0,0,0.25);
color: #000;

You get:

box-shadow: inset 0 3px 9px hsla(0.0, 0.0%, 0.0%, 0.25);
color: hsla(0.0, 0.0%, 0.0%, 0.25);

Multiple Selection breaks ColorConvert

Steps to Reproduces

  1. Select multiple hex values (^D for Quick Add Next)
  2. Run CSS Color Converter (โŒ˜โ‡งC)

Expected Result

  1. Each color is now the appropriate {RGB,HSL} format.

Actual Result

  1. Each color has been replaced with the {RGB,HSL} value for the first selected color.

Feature Request: Convert color values (hex/rgb/hsl) to defined scss variables

In large projects that I work on we always have a color.scss file which defines numerous colors to variables. Often times, remembering those variables can be difficult and am constantly cross-referencing back to the variable definitions to determine which variable to use.

Request feature, to define variables in plugin preferences and autoreplace color values when entered as hex/rgb/hsl to the appropriate variable name.

Sublime Text 3 support

I can't find the package using Package Control on Sublime Text 3.
Any ETA when it's going to be supported?

Ctrl. or Cmd. - Shift - c ?

Hi, very handy plugin.. cudos & thx!

In your Readme you state the keycombo was Ctrl. - Shift - c .. however here on OSX it actually is Cmd. - Shift - c. Dunno if this is a OS thing or the Readme evtl. is outdated.. anyway, just wanted to let you know.

cheers,
Jan

Add "Convert CSS color" to Command Palette

You have put in a shortcut which is very handy. However, shortcuts can be hard to remember if not used often.

It'd be a plus if I could open the command palette and start typing the command, "Convert CSS... enter" or even "Convert CSS color to [rgba]".

An idea for an enhancement. If it's simple enough, it will help me and possibly others. Thanks for the useful plug-in!

Convert to rgb

Is there any plan to allow converting to rgb()? If I'm supporting IE<8 I'd like to be able to just use rgb without alpha.

RGB not A

I'm sorry for bring you this topic, but I believe you took a bad decision when you chose to always use the alpha value.

First, if you allow us to convert to and from HEX, which doesn't support alpha, you're showing that a non-alpha value is acceptable.

Probably, one of the most used tasks for your plugin is to create fallback colors. But, if we can't create RGB colors, we can't use it for IE4-8, which doesn't support RGBA. Personally, I don't care about IE6 or 7 anymore, but, for the God sake, there are still developers who have to. So, without RGB, the fallback colors have to be HEX, what turns into a bug. Your idea of saving self.alpha globally is causing conflicts. If you convert a color with ALPHA value and then convert another color which doesn't have an ALPHA, the value of the previous ALPHA appears again! This is a serious bug.

So, my suggestion for you is just use the ALPHA value if it is different of 1 and to add a comment to the HEX color when it is converted from a value with an ALPHA. For example:

/**
 * Well, this format is just a suggestion.
 */
rgba(20,105,140,.3) -> #14698c/*A: .3*/

I believe that to keep the ALPHA value close to the HEX color makes better fallback colors on CSS and keep the conversion on your plugin easier to code. Even better, allowing RGB and HSL will save 3 characters for every non-ALPHA color and, in the front-end world, size matters.

Convert All option?

I mainly use hex codes out of habit, but sometimes, I need to switch over to RGB for transparency, etc. Would it be possible to have a "convert all" options that switches all HEX colors to RGB?

ValueError: zero length field name in format

Not sure if this is an issue with this plugin or something else. Everything was working fine, then I think it coincided when I updated to Sublime v2.0.2, Build 2221 (but I'm not sure if that is the impetus). Anyway, when I invoke ColorConvert using Cmd+Shift+C on my Mac, I get the following in Sublime's console:

Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./colorconvert.py", line 280, in run
ValueError: zero length field name in format

All other packages and their keyboard mappings seem to be working just fine.

Any help would be appreciated...

License?

I would love to use this in a project I am working on. What is the license?

hex regexp isn't correct

The regexp you're using to detect hex codes isn't correct: it will also match hex codes of 4 and 5 characters.
I don't know about python, but in js this would be what you're looking for:
/^#([a-f\d]{3}){1,2}$/i

Update description request

Please, update description of your plugin. ColorConvert work in Sublime Text 3 too, not only in Sublime Text 2.

Sublime Text 2

People may think that your plugin only for Sublime Text 2, and will not download ColorConvert.

Thanks.

HSL(A)?

Any chance of HSLA conversion? Also, please create a command palette listing instead of a default keybind, and let the user choose where and if they want the keybind - it's very awkward and time-consuming to replace default keybinds at the moment; quite a serious problem in Sublime.

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.