Skip to content

Color themes

Default color scheme

As of version v0.3.0, kubecolor bundles new themes (also referred to as “presets”):

PresetDescription
dark (default)For when your terminal’s background is dark.
lightFor when your terminal’s background is light/bright.
pre-0.0.21-dark, pre-0.0.21-lightOriginal color scheme used before v0.0.21, as well as in the predecessor’s (hidetatz/kubecolor) version.
pre-0.3.0-dark, pre-0.3.0-lightColor scheme used before the introduction of configurable themes in v0.3.0, where we also updated the default theme.
protanopia-dark, protanopia-lightColor theme for Protanopia color blindness.
deuteranopia-dark, deuteranopia-light(*)Color theme for Deuteranopia color blindness.
tritanopia-dark, tritanopia-light(*)Color theme for Tritanopia color blindness.

Kubecolor uses the dark theme by default.

kubectl get podsNAME READY STATUS RESTARTS AGE nginx-7c5ddbdf54-9d575 0/1 ContainerCreating 0 15m nginx-7c5ddbdf54-f6wft 1/1 Running 0 15m nginx-7c5ddbdf54-h6dnn 1/1 Terminating 0 15m nginx-7c5ddbdf54-vtsqw 0/1 CrashLoopBackOff 0 15m

Switching to a different color theme

There’s three way to switch to a different color theme:

  • Temporarily for a single command using the --kubecolor-theme flag:

    Terminal window
    kubecolor get pods --kubecolor-theme=protanopia-dark
  • Setting the environment variable KUBECOLOR_PRESET to a specific theme:

    ~/.bashrc
    export KUBECOLOR_PRESET="protanopia-dark"
  • Configuring the default theme in the configuration file at ~/.kube/color.yaml:

    ~/.kube/color.yaml
    preset: protanopia-dark

Light Theme

you can switch to the light theme by either:

  • setting the variable KUBECOLOR_LIGHT_BACKGROUND=true
  • setting the --light-background argument on the command line
  • setting the variable KUBECOLOR_PRESET="light"
  • configuring the config file ( ~/.kube/color.yaml) with preset: light
kubectl describe pod nginx-7c5ddbdf54-f6wftName: nginx-7c5ddbdf54-f6wft Namespace: default Priority: 0 Service Account: default Node: machine1234/192.168.44.120 Start Time: Wed, 10 Apr 2024 17:05:00 +0200 Labels: app=nginx pod-template-hash=7c5ddbdf54 Annotations: cni.projectcalico.org/containerID: 08638014c5d8c7f5187075635ac8eb947 cni.projectcalico.org/podIP: 172.23.95.3/32 cni.projectcalico.org/podIPs: 172.23.95.3/32 Status: Running IP: 172.23.95.3 IPs: IP: 172.23.95.3 Controlled By: ReplicaSet/nginx-7c5ddbdf54 Containers: nginx: Container ID: containerd://c04d14dc2d678f37cd5a8fbf1659ee99ace9cf5aed0d3ca99b2a9c054afa52ae Image: nginx Image ID: docker.io/library/nginx@sha256:6db391d1c0cfb30588ba0bf72ea999404f2 Port: 80/TCP Host Port: 0/TCP State: Running Started: Wed, 10 Apr 2024 17:05:01 +0200 Ready: True Restart Count: 0 Environment: <none> Mounts: /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-phvsg (ro) Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: kube-api-access-phvsg: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: <nil> DownwardAPI: true QoS Class: BestEffort Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 82s default-scheduler Successfully Normal Pulling 82s kubelet Pulling image "nginx" Normal Pulled 82s kubelet Successfully Normal Created 82s kubelet Created container nginx Normal Started 82s kubelet Started container nginx

Custom color theme

It is also possible to build your own color theme, either by setting some variables or building up a config file.

For example:

Terminal window
export KUBECOLOR_THEME_DATA_NULL="gray:italic"
export KUBECOLOR_THEME_TABLE_HEADER="fg=white:bold:underline"
export KUBECOLOR_THEME_STDERR_ERROR="fg=yellow:bg=red:bold"

To list all environment variables and config options, see:

Fallback colors

Most of our color options have configured “fallback colors”. These config fields don’t have a default value, but instead rely on another config field as their value.

For example, the environment variable KUBECOLOR_THEME_STATUS_SUCCESS, which is used in pod statuses like Ready and Running; does not have a default color. Instead, it has a fallback to the KUBECOLOR_THEME_BASE_SUCCESS config field.

Similarly, the KUBECOLOR_THEME_APPLY_CREATED environment variable (used on the “created” keyword in the kubectl apply command’s output) also has a fallback color to the same “base success” color.

This means that if you override KUBECOLOR_THEME_BASE_SUCCESS then you override both of these use cases at the same time. I.e this:

Terminal window
export KUBECOLOR_THEME_BASE_SUCCESS="light-blue:italic"

Has the same effect as this:

Terminal window
export KUBECOLOR_THEME_STATUS_SUCCESS="light-blue:italic"
export KUBECOLOR_THEME_APPLY_CREATED="light-blue:italic"
# omitting other uses of the "base.success" fallback color for brevity

In effect, this means that you can modify the “base colors” and still adjust most of kubecolor’s output to your color preference, while still allowing you to make finer adjustments where needed.

Additionally, this also acts as forward-compatibility, where kubecolor can add new color config fields and they would still somewhat follow your current theme.

Submitting new themes

We will happily accept any wild, goofy, awesome, super useful, and even weird themes that you want to share with the world!

To submit one, please create a ~/.kube/color.yaml file with the color overrides for your theme and then create a feature request issue over on GitHub.