hugo-theme-re-terminal/demoSite/content/posts/css-vars.md

62 lines
2.0 KiB
Markdown
Raw Normal View History

2024-07-31 10:19:01 +00:00
+++
title = "CSS Variables update"
date = "2024-07-30"
author = "Mirus"
2024-07-31 13:24:30 +00:00
cover = "img/css-variables-update.webp"
2024-07-31 12:24:36 +00:00
description = "A small demo of native CSS Variables. You can create your very own re-Terminal today!"
2024-07-31 10:19:01 +00:00
layout = "css-vars-showcase"
2024-07-31 12:24:36 +00:00
Toc=true
2024-07-31 10:19:01 +00:00
+++
2024-07-31 12:24:36 +00:00
## What is going on?
Hello. This is a first step toward color schema flexibility.
You still can use existing predefined `accent` colors from the list:
- blue
- green
- orange
- pink
- red
but if you need to pick another accent colors you can do it with the help of native CSS Variables.
Just create, if you haven't any yet, `static/style.css`
and redefine two CSS variables, like this
```css
:root {
--accent: blue;
--accent-contrast-color: yellow;
}
```
### Any other CSS Variable I should know?
You can find all of them in the browser's page inspector, but here is the list with default values anyway:
```css
:root {
2024-07-31 13:24:30 +00:00
--accent: #23B0FF; /* 1 of 5 basic colors */
2024-07-31 12:24:36 +00:00
--background: color-mix(in srgb, var(--accent) 2%, #1D1E28 98%); /* background color; inherit shades of the accent */
--accent-contrast-color: black; /* mainly uses for text on the accent backgrounds but not limited */
--color: white; /* text color, also some other text use the variable in color mixing */
--border-color: rgba(255, 255, 255, .1); /* border color */
--phone: "max-width: 684px"; /* phone breakpoint */
--tablet: "max-width: 900px"; /* tablet breakpoint */
/* code syntax */
/* take a look at themes/re-terminal/assets/css/syntax.scss to understand in detail which color stands for */
--syntax-func-color: color-mix(in srgb, var(--accent) 70%, #999 30%);
--syntax-var-color: color-mix(in srgb, var(--accent) 90%, transparent);
--syntax-value-color: color-mix(in srgb, var(--accent), white);
}
```
### Future plans
Already right now you can play with CSS Variables and achieve decent results, but I hope will work on some light-ish presets and maybe on exposing event more tokens to the users.
## The interactive demo