We have a big application on the site and we have a few links which are, let\'s say blue color like the blue links on this site. Now I want to make some other links, but wit
Use the filter
pure CSS property. for a complete description of the filter
property functions read this awesome article.
I had a same issue like yours, and I fixed it by using the brightness
function of filter
property:
.my-class {
background-color: #18d176;
filter: brightness(90%);
}
If you need to brute force it for older browser compatibility, you can use Colllor to automatically select similar color variations.
Example (color: #a9dbb4):
You can do this with CSS filters in all modern browsers (see the caniuse compatibility table).
.button {
color: #ff0000;
}
/* note: 100% is baseline so 85% is slightly darker,
20% would be significantly darker */
.button:hover {
filter: brightness(85%);
}
<button class="button">Foo lorem ipsum</button>
Here's more reading from CSS Tricks about the various filters you can use: https://css-tricks.com/almanac/properties/f/filter/
HSL Colors provide an answer, a HSL color value is specified with: hsl(hue [0,255], saturation %, lightness %).
HSL is supported in IE9+, Firefox, Chrome, Safari, and in Opera 10+
a
{
color:hsl(240,65%,50%);
}
a.lighter
{
color:hsl(240,65%,75%);
}
If you're using a stack which lets you use SASS, you can use the lighten function:
$linkcolour: #0000FF;
a {
color: $linkcolour;
}
a.lighter {
color: lighten($linkcolour, 50%);
}
Not directly, no. But you could use a site, such as colorschemedesigner.com, that will give you your base color and then give you the hex and rgb codes for different ranges of your base color.
Once I find my color schemes for my site, I put the hex codes for the colors and name them inside a comment section at the top of my stylesheet.
Some other color scheme generators include: