Skip to content

Design System

Textual's design system consists of a number of predefined colors and guidelines for how to use them in your app.

You don't have to follow these guidelines, but if you do, you will be able to mix builtin widgets with third party widgets and your own creations, without worrying about clashing colors.


Textual's color system is based on Google's Material design system, modified to suit the terminal.

Designing with Colors

Textual pre-defines a number of colors as CSS variables. For instance, the CSS variable $primary is set to #004578 (the blue used in headers). You can use $primary in place of the color in the background and color rules, or other any other rule that accepts a color.

Here's an example of CSS that uses color variables:

MyWidget {
    background: $primary;
    color: $text;

Using variables rather than explicit colors allows Textual to apply color themes. Textual supplies a default light and dark theme, but in the future many more themes will be available.

Base Colors

There are 12 base colors defined in the color scheme. The following table lists each of the color names (as used in CSS) and a description of where to use them.

Color Description
$primary The primary color, can be considered the branding color. Typically used for titles, and backgrounds for strong emphasis.
$secondary An alternative branding color, used for similar purposes as $primary, where an app needs to differentiate something from the primary color.
$primary-background The primary color applied to a background. On light mode this is the same as $primary. In dark mode this is a dimmed version of $primary.
$secondary-background The secondary color applied to a background. On light mode this is the same as $secondary. In dark mode this is a dimmed version of $secondary.
$background A color used for the background, where there is no content.
$surface The color underneath text.
$panel A color used to differentiate a part of the UI form the main content. Typically used for dialogs or sidebars.
$boost A color with alpha that can be used to create layers on a background.
$warning Indicates a warning. Text or background.
$error Indicates an error. Text or background.
$success Used to indicate success. Text or background.
$accent Used sparingly to draw attention to a part of the UI (typically borders around focused widgets).


For every color, Textual generates 3 dark shades and 3 light shades.

  • Add -lighten-1, -lighten-2, or -lighten-3 to the color's variable name to get lighter shades (3 is the lightest).
  • Add -darken-1, -darken-2, and -darken-3 to a color to get the darker shades (3 is the darkest).

For example, $secondary-darken-1 is a slightly darkened $secondary, and $error-lighten-3 is a very light version of the $error color.

Dark mode

There are two color themes in Textual, a light mode and dark mode. You can switch between them by toggling the dark attribute on the App class.

In dark mode $background and $surface are off-black. Dark mode also set $primary-background and $secondary-background to dark versions of $primary and $secondary.

Text color

The design system defines three CSS variables you should use for text color.

  • $text sets the color of text in your app. Most text in your app should have this color.
  • $text-muted sets a slightly faded text color. Use this for text which has lower importance. For instance a sub-title or supplementary information.
  • $text-disabled sets faded out text which indicates it has been disabled. For instance, menu items which are not applicable and can't be clicked.

You can set these colors via the color property. The design system uses auto colors for text, which means that Textual will pick either white or black (whichever has better contrast).


These text colors all have some alpha applied, so that even $text isn't pure white or pure black. This is done because blending in a little of the background color produces text that is not so harsh on the eyes.


In a future version of Textual you will be able to modify theme colors directly, and allow users to configure preferred themes.

Color Preview

Run the following from the command line to preview the colors defined in the color system:

textual colors

Theme Reference

Here's a list of the colors defined in the default light and dark themes.


$boost will look different on different backgrounds because of its alpha channel.

Textual Theme Colors                 Light                                  Dark                           $primary-darken-3                   $primary-darken-3                    $primary-darken-2                   $primary-darken-2                    $primary-darken-1                   $primary-darken-1                         $primary                            $primary                        $primary-lighten-1                  $primary-lighten-1                   $primary-lighten-2                  $primary-lighten-2                   $primary-lighten-3                  $primary-lighten-3                  $secondary-darken-3                 $secondary-darken-3                  $secondary-darken-2                 $secondary-darken-2                  $secondary-darken-1                 $secondary-darken-1                       $secondary                          $secondary                      $secondary-lighten-1                $secondary-lighten-1                 $secondary-lighten-2                $secondary-lighten-2                 $secondary-lighten-3                $secondary-lighten-3                 $background-darken-3                $background-darken-3                 $background-darken-2                $background-darken-2                 $background-darken-1                $background-darken-1                     $background                         $background                     $background-lighten-1               $background-lighten-1                $background-lighten-2               $background-lighten-2                $background-lighten-3               $background-lighten-3             $primary-background-darken-3        $primary-background-darken-3         $primary-background-darken-2        $primary-background-darken-2         $primary-background-darken-1        $primary-background-darken-1             $primary-background                 $primary-background             $primary-background-lighten-1       $primary-background-lighten-1        $primary-background-lighten-2       $primary-background-lighten-2        $primary-background-lighten-3       $primary-background-lighten-3        $secondary-background-darken-3      $secondary-background-darken-3       $secondary-background-darken-2      $secondary-background-darken-2       $secondary-background-darken-1      $secondary-background-darken-1           $secondary-background               $secondary-background           $secondary-background-lighten-1     $secondary-background-lighten-1      $secondary-background-lighten-2     $secondary-background-lighten-2      $secondary-background-lighten-3     $secondary-background-lighten-3             $surface-darken-3                   $surface-darken-3                    $surface-darken-2                   $surface-darken-2                    $surface-darken-1                   $surface-darken-1                         $surface                            $surface                        $surface-lighten-1                  $surface-lighten-1                   $surface-lighten-2                  $surface-lighten-2                   $surface-lighten-3                  $surface-lighten-3                    $panel-darken-3                     $panel-darken-3                      $panel-darken-2                     $panel-darken-2                      $panel-darken-1                     $panel-darken-1                           $panel                              $panel                          $panel-lighten-1                    $panel-lighten-1                     $panel-lighten-2                    $panel-lighten-2                     $panel-lighten-3                    $panel-lighten-3                     $boost-darken-3                     $boost-darken-3                      $boost-darken-2                     $boost-darken-2                      $boost-darken-1                     $boost-darken-1                           $boost                              $boost                          $boost-lighten-1                    $boost-lighten-1                     $boost-lighten-2                    $boost-lighten-2                     $boost-lighten-3                    $boost-lighten-3                    $warning-darken-3                   $warning-darken-3                    $warning-darken-2                   $warning-darken-2                    $warning-darken-1                   $warning-darken-1                         $warning                            $warning                        $warning-lighten-1                  $warning-lighten-1                   $warning-lighten-2                  $warning-lighten-2                   $warning-lighten-3                  $warning-lighten-3                    $error-darken-3                     $error-darken-3                      $error-darken-2                     $error-darken-2                      $error-darken-1                     $error-darken-1                           $error                              $error                          $error-lighten-1                    $error-lighten-1                     $error-lighten-2                    $error-lighten-2                     $error-lighten-3                    $error-lighten-3                    $success-darken-3                   $success-darken-3                    $success-darken-2                   $success-darken-2                    $success-darken-1                   $success-darken-1                         $success                            $success                        $success-lighten-1                  $success-lighten-1                   $success-lighten-2                  $success-lighten-2                   $success-lighten-3                  $success-lighten-3                    $accent-darken-3                    $accent-darken-3                     $accent-darken-2                    $accent-darken-2                     $accent-darken-1                    $accent-darken-1                         $accent                             $accent                         $accent-lighten-1                   $accent-lighten-1                    $accent-lighten-2                   $accent-lighten-2                    $accent-lighten-3                   $accent-lighten-3