Answer the question
In order to leave comments, you need to log in
How to organize a common set of CSS colors in Rails + Vue.js?
I am creating an application on Ruby on Rails where the public part of the pages is implemented through a standard render (slim), and the admin part using Vue. It is required to have a common set of standard corporate colors that are common for the public part and for the internal one.
Right now I'm using Tailwindcss with custom colors and it's definitely not ideal.
I have colors in tailwind.js:
colors: {
white: 'hsl(200, 2%, 90%)',
'white-50': 'hsla(200, 2%, 90%, 0.5)',
'white-20': 'hsla(200, 2%, 90%, 0.2)',
...
}
$white: hsl(200, 2%, 90%);
$white-50: color($white alpha(.5));
$white-20: color($white alpha(.2));
$white-05: color($white alpha(.05));
label {
@apply uppercase text-white;
}
<style style="scss" scoped>
.panel {
@apply border border-white;
}
</style>
$red-grad-x-hover: linear-gradient(to right, color($orange brighten(10%)), color($red brighten(10%)));
Answer the question
In order to leave comments, you need to log in
If you don't need to support IE11, then you can use CSS variables. More or less like this:
:root {
--white-color: 200, 2%, 90%;
--white-alpha: 100%;
--white: hsla(var(--white-color), var(--white-alpha));
}
.component {
background: var(--white);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question