TTY detection foreground/background color
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 122k
- Forks
- 37.3k
- Merge moyen
- 4 j 2 h
- PR mergées (30 j)
- 283
Description
What is the problem this feature will solve?
For tty’s if you output any text in black, particularly when doing TUI’s one is likely to get a rude awakening when they discover that their users are using dark mode and none of that text is visible because it’s jet black on a charcoal gray background. It would be best in such cases to simply print this text in the default foreground color, but that does not guarantee that other colors will be high contrast. For instance dark blue on charcoal gray, or yellow text on iTerm's default eggshell white background, versus orange which shows well on both light and dark mode terminals.
What is the feature you are proposing to solve the problem?
Add a function to write stream to query the foreground color the way color depth can be queried. And if at all possible, also the background color.
What alternatives have you considered?
Workarounds include:
- setting a background color and printing over it, but that makes the text/graphic look more important than it is
- resetting the tty codes rather than setting “black” - but this fails if you are looking for a more general case of high contrast colors, like dark gray on a bright background and light gray on a dark one.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Aucun fichier d’implémentation ni test n’est indiqué. Commencez par localiser l’API de stream existante qui interroge la profondeur de couleur du terminal, puis examinez la manière dont le comportement de TTY est géré sur les plateformes prises en charge. Le travail est considéré comme terminé lorsqu’une fonction de stream définie peut interroger la couleur d’avant-plan et, lorsque cela est possible, la couleur d’arrière-plan, avec une couverture des cas pertinents.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- node.js
- Domaine
- cli
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100