Skip to content

Add support to configure colors for pods and containers - #306

Merged
tksm merged 1 commit into
stern:masterfrom
zlabjp:configure-colors
May 22, 2024
Merged

tksm merged 1 commit into
stern:masterfrom
zlabjp:configure-colors

Conversation

@tksm

@tksm tksm commented May 22, 2024

Copy link
Copy Markdown
Contributor

Fixes #298

This PR adds support for configuring colors for pods and containers.

podColors="38;2;255;97;136,38;2;169;220;118,38;2;255;216;102,38;2;120;220;232,38;2;171;157;242"
dist/stern --pod-colors "$podColors" --tail 1 --only-log-lines deployment/app
image

Customize highlight colors

You can configure highlight colors for pods and containers in the config file using a comma-separated list of SGR (Select Graphic Rendition) sequences, as shown below. If you omit container-colors, the pod colors will be used as container colors as well.

# Green, Yellow, Blue, Magenta, Cyan, White
pod-colors: "32,33,34,35,36,37"

# Colors with underline (4)
# If empty, the pod colors will be used as container colors
container-colors: "32;4,33;4,34;4,35;4,36;4,37;4"

This format enables the use of various attributes, such as underline, background colors, 8-bit colors, and 24-bit colors, if your terminal supports them.

The equivalent flags --pod-colors and --container-colors are also available. The following command applies 24-bit colors using the --pod-colors flag.

# Monokai theme
podColors="38;2;255;97;136,38;2;169;220;118,38;2;255;216;102,38;2;120;220;232,38;2;171;157;242"
stern --pod-colors "$podColors" deploy/app

@superbrothers superbrothers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@tksm
tksm merged commit f4b2edc into stern:master May 22, 2024
@tksm
tksm deleted the configure-colors branch May 22, 2024 22:45
@orguz-velo

Copy link
Copy Markdown

Amazing, thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support a dynamic list of colors

3 participants