Migrate to bulma-css-variables and introduce dark mode #954
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
|
||||
:focus {
|
||||
box-shadow: 0 0 0 2px var(--primary-translucent);
|
||||
box-shadow: 0 0 0 2px hsla(var(--primary-hsl), 0.5);
|
||||
adrinux marked this conversation as resolved
Outdated
|
||||
}
|
||||
|
||||
:focus:not(:focus-visible) {
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
:focus-visible,
|
||||
:-moz-focusring {
|
||||
box-shadow: 0 0 0 2px var(--primary-translucent);
|
||||
box-shadow: 0 0 0 2px hsla(var(--primary-hsl), 0.5);
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
|
@ -65,11 +65,11 @@
|
|||
--primary-l: 54.9%;
|
||||
--primary-light-l: 73%;
|
||||
--primary-a: 1;
|
||||
--primary-hsl: 216.5deg, 100%, 54.9%;
|
||||
--primary: hsla(var(--primary-h), var(--primary-s), var(--primary-l), var(--primary-a));
|
||||
|
||||
adrinux marked this conversation as resolved
Outdated
dpschen
commented
Is it possible to use Is it possible to use `calc()` here?
dpschen
commented
Ahh I saw the Ahh I saw the `!important` now
adrinux
commented
I did initially but really I think it just obfuscates the actual value, though I don't much like the this either.
Works to give a 30% increase? --primary-light is only used in src/views/tasks/TaskDetailView.vue and I've no idea what end result it has. Can't see what different values do. Any idea? If we stick with hard coding a value I wonder if using the pattern bulma-css-variables uses would be clearer:
Thoughts? EDIT: have actually just changed it to the latter. > Is it possible to use `calc()` here?
I did initially but really I think it just obfuscates the actual value, though I don't much like the this either.
So:
```
calc(var(--primary-l) * 1.3)
```
Works to give a 30% increase?
--primary-light is only used in src/views/tasks/TaskDetailView.vue and I've no idea what end result it has. Can't see what different values do. Any idea?
If we stick with hard coding a value I wonder if using the pattern bulma-css-variables uses would be clearer:
```
--primary-h: 216.5deg !important;
--primary-s: 100% !important;
--primary-l: 54.9% !important;
--primary-light-l: 73%;
--primary-a: 1 !important;
--primary: hsla(var(--primary-h), var(--primary-s), var(--primary-l), var(--primary-a));
// simulate sass lighten($primary, 30) by increasing lightness 30% to 73%
--primary-light: hsla(var(--primary-h), var(--primary-s), var(--primary-light-l), var(--primary-a));
--primary-translucent: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.5);
```
Thoughts? EDIT: have actually just changed it to the latter.
|
||||
// simulate sass lighten($primary, 30) by increasing lightness 30% to 73%
|
||||
--primary-light: hsla(var(--primary-h), var(--primary-s), var(--primary-light-l), var(--primary-a));
|
||||
--primary-translucent: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.5);
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
adrinux marked this conversation as resolved
Outdated
dpschen
commented
Nest the Nest the `@media` so we don't need to repeat `:root`.
adrinux
commented
Good catch. Done Good catch. Done https://kolaente.dev/adrinux/frontend/commit/a258b938fabdb69b30615897b157c37a020b4059
konrad
commented
Maybe it would make sense to group all dark scheme adjustments (and the base light versio) in separate stylesheets instead of seperating by color or shadows? Maybe it would make sense to group all dark scheme adjustments (and the base light versio) in separate stylesheets instead of seperating by color or shadows?
dpschen
commented
I think this is fine. Because we might need adjustments deep in components for dark mode either way. I think this is fine. Because we might need adjustments deep in components for dark mode either way.
I think it would be wrong to separate those styles from the components.
konrad
commented
That's something I didn't think about. Makes sense. That's something I didn't think about. Makes sense.
|
||||
/* Light mode colours reversed for dark mode */
|
||||
|
|
Doesn't
rgba(var(--primary), 0.5)
work?No, since the var already includes
hsla()
so resolved by the browser it would be double wrapped:See: https://kolaente.dev/vikunja/frontend/pulls/954/files#issuecomment-18553
rgba()
also just accepts r, g, b, a values. SASS would render this as as the css rgba() and not the SCSSrgba()
helper since it includes a custom-property which can not be resolved by SASS at build time.Given that --primary-translucent is only used twice (both in theme.scss, lines 8 & 18), it might make more sense to use the existing primary-* vars to build those 2 instances.
or do what I've done with some of the greys and define a 'naked' --primary-hsl that we can drop in:
I think the latter is most readable, and doesn't make the alpha value hard to see.
Thoughts @konrad @dpschen ?
I think the second one makes most sense.
I just realize that we have to define that
--primary-hsl
just for that usecase. Then we could also just keep with the--primary-translucent
.Because of that I would prefer the first solution. 🤷♂️
I created --primary-hsl as described above
6c59567ebf