Skip to content

Commit

Permalink
fix: add NO_COLOR support to the config wizard (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
tconbeer authored Oct 31, 2024
1 parent d1f337f commit 60c2e46
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.

- Fixes a bug where string data was rendered as Rich Markup ([#647](https://github.com/tconbeer/harlequin/issues/647) - thank you [@burncitiesburn](https://github.com/burncitiesburn)!).
- Fixes a bug where `None` could be inconsistently displayed as `"None"` or the correct `∅ null` ([#658](https://github.com/tconbeer/harlequin/issues/658), [#655](https://github.com/tconbeer/harlequin/issues/655) - thank you, [@sgpeter1](https://github.com/sgpeter1)!).
- `harlequin --config` now supports the `NO_COLOR` environment variable (the rest of the app already supported it) ([#552](https://github.com/tconbeer/harlequin/issues/552) - thank you [@glujan](https://github.com/glujan)!).

## [1.25.1] - 2024-10-31

Expand Down
44 changes: 31 additions & 13 deletions src/harlequin/colors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
from typing import Dict, Type

from pygments.style import Style as PygmentsStyle
Expand Down Expand Up @@ -58,19 +59,36 @@ class HarlequinPygmentsStyle(PygmentsStyle):
highlight_color = DARK_GRAY


HARLEQUIN_QUESTIONARY_STYLE = QuestionaryStyle(
[
("qmark", f"fg:{GREEN} bold"),
("question", "bold"),
("answer", f"fg:{YELLOW} bold"),
("pointer", f"fg:{YELLOW} bold"),
("highlighted", f"fg:{YELLOW} bold"),
("selected", f"fg:{YELLOW} noreverse bold"),
("separator", f"fg:{PURPLE}"),
("instruction", "fg:#858585 italic"),
("text", ""),
("disabled", "fg:#858585 italic"),
]
HARLEQUIN_QUESTIONARY_STYLE = (
QuestionaryStyle(
[
("qmark", "fg:ansidefault bold"),
("question", "fg:ansidefault nobold"),
("answer", "fg:ansidefault bold"),
("pointer", "fg:ansidefault bold"),
("highlighted", "fg:ansidefault bold"),
("selected", "fg:ansidefault noreverse bold"),
("separator", "fg:ansidefault"),
("instruction", "fg:ansidefault italic"),
("text", ""),
("disabled", "fg:ansidefault italic"),
]
)
if os.getenv("NO_COLOR")
else QuestionaryStyle(
[
("qmark", f"fg:{GREEN} bold"),
("question", "bold"),
("answer", f"fg:{YELLOW} bold"),
("pointer", f"fg:{YELLOW} bold"),
("highlighted", f"fg:{YELLOW} bold"),
("selected", f"fg:{YELLOW} noreverse bold"),
("separator", f"fg:{PURPLE}"),
("instruction", "fg:#858585 italic"),
("text", ""),
("disabled", "fg:#858585 italic"),
]
)
)


Expand Down

0 comments on commit 60c2e46

Please sign in to comment.