Since 2023 you can use the
color-mix
function to create new colors based on other colors.
background-color: color-mix(in oklab, green, white);
The above will produce a lighter green, mixing 50% green with 50% white.
You can alter those percentages.
background-color: color-mix(in oklab, green 40%, white 30%);
When the total is less than 100% the remainder is given to transparency. When the total is above 100% the final listed value is reduced until 100% is the total.
oklab
is a color space. I found it was summed best here, which describes oklab
as:
the most useful and desired option, which is perceptually uniform mixing. In other words a 50-50 mix of two colors gives the color that looks halfway between them.
You can record macros in vim.
-
qq
to start recording into register q. -
q
to stop recording. -
@q
to play the macro from register q.
But that last step can be called while recording.
-
qq
to start recording into register q. -
@q
to call the macro you are now recording. -
q
to stop recording. -
@q
to play the macro from register q.
Now you have a recursive macro. This macro will keep executing until an
unsuccessful movement, for example f
is used to find a character, but the
character does not exist. Or, when j
is used to move the cursor down, but you
are at the end of the file.
You can use this technique instead of recording a macro and playing the macro X times. X isn’t always immediately obvious.
For greatest effectiveness start with an empty macro before creating a recursive macro.
-
qqq
empty the macro for the register q. -
qq
to start recording into register q. -
@q
to call the macro you are now recording. -
q
to stop recording. -
@q
to play the macro from register q.
Now you have a lot of qs.
When the priv
directory is deployed, it may not be in the same relative
location as it is in project.
You can use :code.priv_dir
with the name of your app as an argument to get
the location of the priv
dir after deployment and in your dev env.
iex(1)> :code.priv_dir(:blog)
~c"/home/chris/projects/blog/_build/dev/lib/blog/priv"
It might have been a while since I have written CSS. I’ve always been a fan of SCSS with its variables and nesting. I knew browsers could natively define and use css variables now, but I’m just now learning that I can nest CSS selectors just like in SCSS. Since 2023
header {
a {
color: var(--pleasantly-surprised);
}
}