Colorify: a small library converts binary to hex colors for css

Hello Elixirians,
I have wrote a very small package to convert binaries into hex colors. please have a look at the code ( ) and let me know, how i can improve this. i have plans to support other color formats as well. i.e hsl, rgb, rgba etc

I’m into code since more than 17 years. i am following elixir since July 2014 but this is my first try to contribute back to community. if everything goes well, i have plans to write more packages.

thanks you all.


Besides if the comments I already gave inline, I think you should make more clear that it does not translate strings into colors but creates a hash that can be used as RGB color value in CSS or HTML.

1 Like

i have made changes according to your valuable comments. Yeah it can be used to generate colors for css and html. i will update the README in a while. Thanks for the feedback.

Hi @murtza

It is so useful
Btw, i dont feel like installing a hex package for that!
Its more like a Gist to me

Thank you

1 Like

Eh, a hex package is best for it, that way updates and fixes are centralized instead of copying in to N number of projects.


Off topic
I do like packages and DRY but with this mindset you end up with the npm community and left-pad :wink:

Sometimes it’s better to have the code in your project so you can see what it does, update it and so on. Sure with a package you get bug fixes, but new bugs are also introduced when you update the packages. Perhaps the project adds a bunch of new features that you don’t even need and that introduces new bugs in the features you actually care about. If it’s a large project it may be worth it because it would cost you a significant amount of money and time to create the functionality yourself.

I’d rather have 10 lines of code duplicated in a few projects than too many external dependencies.

On topic:
Sorry to hijack the thread with this discussion. :slight_smile: Good job on the project! :+1:


Hi @alisinabh
It wont be a gist for long because i have plans to add more functionality about generating colors. i.e rgb, rgba, hsl and pastel colors etc. You are an expert but please don’t forget about new comers. I think, these kind of small packages will invite new developers to our community and they can focus on getting things done rapidly.

i completely agree with @OvermindDL1 point of view. You know rails got popular because you can find a gem for almost any kind of task (leaving aside coding standards). If we write good code and focus on the problem, we are going to fix than we will make our life easy. for example Unix’s small libraries.


Part of their problem was that you were able to pull the rug out from under a bunch of people and completely change what a library was. This isn’t possible with Hex in any capacity, as far as I know, and so the left-pad debacle shouldn’t be a possible issue.

I also don’t feel like the existence of small packages is something that people should be concerned by. If people want to depend on these small packages, that’s fine: Let them. We don’t all have to have the same exact idea of where the bar for a dependency is.


People who don’t want to have a lot of small dependencies (which, as @gon782 just explained wasn’t the actual problem with npm) can just copy and paste the main module file into their own project. It’s really not something worth arguing about.