Implement Bright Foreground Colors.

Open Beginner friendly
#12 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
cli

Research direction

Start at the linked Color.cpp location and trace how _COLOR_BRIGHT, _COLOR_FG, and _COLOR_BG are defined and used. Separate the foreground-bright and background-bright flags, then verify that ANSI output can select the upper eight foreground colors without relying on inverse, bright, and bold background/foreground combinations.

Written by the indexing model from the issue text.

Description

The _COLOR_BRIGHT flag should be separated into _COLOR_FGBRIGHT and _COLOR_BGBRIGHT to allow accessing the upper 8 colors in ANSI mode. Particularly this allows access to bright and bold colors.

The output coding currently as: https://github.com/GothenburgBitFactory/libshared/blob/ba9b76db8f6180dc62f0bdbdd012891d818108e8/src/Color.cpp#L487 would then be changed to:

    result += colorstring[((_value & _COLOR_FGBRIGHT ? 89 : 29) + (_value & _COLOR_FG))];

Currently it's possible to trick the existing code into giving bright and bold colors by requesting inverse bright bold <background> on <foreground> but this is really quite ugly.

Dominant language
C++
Stars
7
Forks
30
Avg merge
13h 17m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GothenburgBitFactory/libshared

All issues in GothenburgBitFactory/libshared

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.