io.worxbend.tui.core.palette

Members list

Type members

Classlikes

final case class Accented(tonal: Tonal, a100: Color, a200: Color, a400: Color, a700: Color)

A Tonal ramp plus the four saturated accent shades Material gives most of its hues.

A Tonal ramp plus the four saturated accent shades Material gives most of its hues.

The accents are not further steps of the same ramp: they are deliberately more vivid than any of c50…c900, and Material uses them for the one thing on a screen that has to be noticed — a selection, an alert, a call to action. As a general surface or body colour they are exhausting, which is why they are named apart here rather than folded into all.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Material

The Material Design 2014 colour palette: 16 hue ramps with accents, 3 without, plus a pure Black and White.

The Material Design 2014 colour palette: 16 hue ramps with accents, 3 without, plus a pure Black and White.

The second design-system palette tui-core ships, beside Tailwind, and it exists for the same reason: the sixteen named ANSI colours are whatever the reader's terminal theme says they are, and past those the only option is a hand-picked hex literal. Choosing a coherent set of those is design work that has already been done, publicly, twice over — and both answers are here as plain data.

Which to reach for is taste rather than capability. Material's ramps are warmer and its accents far more saturated than Tailwind's, so a Material accent shouts where a Tailwind c500 speaks. Every value is a 24-bit io.worxbend.tui.core.Color.Rgb, so it renders identically wherever true colour is supported and is unaffected by the user's theme — which is what you want for a chart series or a status badge, and deliberately what you do not want for the general chrome of an application that should blend into the terminal around it.

import io.worxbend.tui.core.palette.Material

val warn     = Material.Amber.c700
val urgent   = Material.Red.a400 // an accent: for the one thing that must be seen
val surfaces = Seq(Material.BlueGray.c900, Material.BlueGray.c800, Material.BlueGray.c700)

Names are spelled the Scala way (DeepOrange, BlueGray) rather than Material's own DEEP_ORANGE. Values are transcribed from the published specification.

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Self type
Material.type
object Shades

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Shades.type
final case class Shades(c50: Color, c100: Color, c200: Color, c300: Color, c400: Color, c500: Color, c600: Color, c700: Color, c800: Color, c900: Color, c950: Color)

One Tailwind hue ramp: eleven shades of the same colour, from the near-white c50 to the near-black c950.

One Tailwind hue ramp: eleven shades of the same colour, from the near-white c50 to the near-black c950.

The numbers are Tailwind's own step names, not indices — they run 50, 100, 200 … 900, 950 — and they mean the same thing in every ramp, so Tailwind.Blue.c500 and Tailwind.Red.c500 sit at the same visual weight. That is what a ramp is for: pick the step once for a role (a c600 border, a c100 surface) and every hue swapped into that role keeps the design intact.

A plain immutable value with no behaviour beyond the two lookups below, so it costs nothing to hold in a theme or carry through a render pass.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Tailwind

The Tailwind CSS default colour palette: 22 hue ramps of eleven shades each, plus a pure Black and White.

The Tailwind CSS default colour palette: 22 hue ramps of eleven shades each, plus a pure Black and White.

A terminal application has two places to get a colour from, and there is a gap between them. The sixteen named ANSI colours are whatever the user's terminal theme says they are — useful, because they follow the user's taste, but you cannot know what Color.Red will actually look like or whether text on it will be readable. Past those, the only option is a hand-picked hex literal, and choosing a coherent set of them is design work.

This is that design work, already done and widely recognised. Every value here is a 24-bit Color.Rgb, so it renders identically in every terminal that supports true colour and is unaffected by the user's theme — which is what you want for a chart series or a status badge, and what you deliberately do '''not''' want for the general chrome of an application that should blend into the terminal around it.

import io.worxbend.tui.core.palette.Tailwind

val ok    = Tailwind.Emerald.c500
val warn  = Tailwind.Amber.c500
val panel = Tailwind.Slate.c800

// one hue at several weights: the shape a hierarchy of surfaces takes
val surfaces = Seq(Tailwind.Slate.c900, Tailwind.Slate.c800, Tailwind.Slate.c700)

Pure data in tui-core with no dependency of its own, so widgets, the DSL and applications all reach the same names. Values are transcribed from the Tailwind CSS v3 default palette.

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Self type
Tailwind.type
final case class Tonal(c50: Color, c100: Color, c200: Color, c300: Color, c400: Color, c500: Color, c600: Color, c700: Color, c800: Color, c900: Color)

One Material tonal ramp: ten shades of a hue, from the near-white c50 to the deep c900.

One Material tonal ramp: ten shades of a hue, from the near-white c50 to the deep c900.

The numbers are Material's own step names, not indices — 50, 100, 200 … 900 — and a step means the same visual weight in every ramp, so Material.Red.c500 and Material.Blue.c500 sit at the same level. Pick a step once for a role (a c700 bar, a c100 surface) and any hue swapped into that role keeps the design intact.

Material's ramps stop at c900; Tailwind's Shades have a further c950, which is why these are two types rather than one shared one. A plain immutable value with no behaviour beyond the two lookups below.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Tonal

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Tonal.type
object Xterm256 extends ExportPalette

The xterm 256-colour table as an ExportPalette: the sixteen ANSI colours at the values most emulators ship, the 6x6x6 cube and the 24-step grey ramp — the same decoding Color.approximateRgb performs, published under the name a reader of an exported screenshot would look for.

The xterm 256-colour table as an ExportPalette: the sixteen ANSI colours at the values most emulators ship, the 6x6x6 cube and the 24-step grey ramp — the same decoding Color.approximateRgb performs, published under the name a reader of an exported screenshot would look for.

A real terminal lets the user re-theme the first sixteen entries; an export has no terminal to ask, so this palette paints them at xterm's own defaults. Supply another ExportPalette through ExportOptions.palette to render a screenshot in a specific terminal theme. Stateless and safe to share between threads.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Xterm256.type