Skip to content

wezterm.color.parse(string)

Since: Version 20220807-113146-c2fee766

The functionality described in this section requires version 20220807-113146-c2fee766 of wezterm, or a more recent version.

Parses the passed color and returns a Color object. Color objects evaluate as strings but have a number of methods that allow transforming and comparing colors.

> wezterm.color.parse("black")
#000000

This example picks a foreground color, computes its complement in the "artist's color wheel" to produce a purple color and then darkens it to use it as a background color:

local wezterm = require 'wezterm'

local fg = wezterm.color.parse 'yellow'
local bg = fg:complement_ryb():darken(0.2)

return {
  colors = {
    foreground = fg,
    background = bg,
  },
}