jay padaliya
jay padaliya

Reputation: 704

How to know offset between two hexadecimal color code

I want to make a theme where a user can input one hexadecimal color for a theme. but a theme has made by various pre-defined color. So my question is that how to know offset between two colors code and using that offset generate a new color,

So for example:

If a user selects color code #110360 then theme header color should be #1c3ea4. so now how to know offset between it, so if user change color then calculates a header color using that offset.

I am using sass to design theme

Thank you

Upvotes: 2

Views: 465

Answers (1)

Kodie Grantham
Kodie Grantham

Reputation: 2032

You will have to use Javascript for something like this unless you are able to compile your Sass on the fly when a user chooses their base color.

The SO answer here seems to have what you're looking for: https://stackoverflow.com/a/9821101/5463842

Upvotes: 1

Related Questions