mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: use ANSI colors codes instead of RGB (#14665)
* chore: add command for showing colors * fix: use ANSI color codes instead of RGB * feat: add '--no-color' flag * fix: revert colors * chore: change colors * fix: update golden files * fix: replace blue with brightBlue * fix: drop '> ' for unfocused prompts * fix: run 'make fmt' * chore: allow disabling color with env flags * fix: apply fixes from feedback * fix: run 'make gen' * fix: refactor janky code * fix: re-add public function * fix: re-add init for non-color tests * fix: move styles to 'init' that can be * fix: stop overwriting entire DefaultStyles * fix: make code and field obey --no-color * fix: rip out '--no-color' due to race condition We still support `NO_COLOR` env variable through termenv's `EnvColorProfile`. The reason for the race condition is that `DefaultStyles` is a global that we shouldn't mutate after `init` is called, but we have to mutate it after `init` has ran to have serpent collect the cli flags and env vars for us. * fix: apply nit * fix: simplify code && hide command * fix: newline shouldn't be themed * fix: appease the linter
This commit is contained in:
+5
-5
@@ -256,7 +256,7 @@ func (m selectModel) View() string {
|
||||
if m.cursor == start+i {
|
||||
style = pretty.Style{
|
||||
pretty.Wrap("> ", ""),
|
||||
pretty.FgColor(Green),
|
||||
DefaultStyles.Keyword,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,13 +481,13 @@ func (m multiSelectModel) View() string {
|
||||
o := option.option
|
||||
|
||||
if m.cursor == i {
|
||||
cursor = pretty.Sprint(pretty.FgColor(Green), "> ")
|
||||
chosen = pretty.Sprint(pretty.FgColor(Green), "[ ]")
|
||||
o = pretty.Sprint(pretty.FgColor(Green), o)
|
||||
cursor = pretty.Sprint(DefaultStyles.Keyword, "> ")
|
||||
chosen = pretty.Sprint(DefaultStyles.Keyword, "[ ]")
|
||||
o = pretty.Sprint(DefaultStyles.Keyword, o)
|
||||
}
|
||||
|
||||
if option.chosen {
|
||||
chosen = pretty.Sprint(pretty.FgColor(Green), "[x]")
|
||||
chosen = pretty.Sprint(DefaultStyles.Keyword, "[x]")
|
||||
}
|
||||
|
||||
_, _ = s.WriteString(fmt.Sprintf(
|
||||
|
||||
Reference in New Issue
Block a user