Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add NO_COLOR support to the config wizard #678

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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