Skip to content

Commit f2a6159

Browse files
committed
Added documentation to colors.Color and resorted its members with a natural sort.
1 parent 5f91f70 commit f2a6159

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

cmd2/colors.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,28 @@
1111
class Color(StrEnum):
1212
"""An enumeration of all color names supported by the Rich library.
1313
14-
Using this enum allows for autocompletion and prevents typos when
15-
referencing color names. The members can be used for both foreground
16-
and background styling.
14+
Using this enum allows for autocompletion and prevents typos when referencing
15+
color names. The members can be used for both foreground and background colors.
16+
17+
Aside from DEFAULT, these colors come from the rich.color.ANSI_COLOR_NAMES dictionary.
18+
19+
The following colors are the 16 whose appearance is determined by the terminal.
20+
- BLACK
21+
- BLUE
22+
- BRIGHT_BLACK
23+
- BRIGHT_BLUE
24+
- BRIGHT_CYAN
25+
- BRIGHT_GREEN
26+
- BRIGHT_MAGENTA
27+
- BRIGHT_RED
28+
- BRIGHT_WHITE
29+
- BRIGHT_YELLOW
30+
- CYAN
31+
- GREEN
32+
- MAGENTA
33+
- RED
34+
- WHITE
35+
- YELLOW
1736
"""
1837

1938
DEFAULT = "default" # Represents the terminal's default foreground or background color.
@@ -79,13 +98,13 @@ class Color(StrEnum):
7998
GOLD1 = "gold1"
8099
GOLD3 = "gold3"
81100
GRAY0 = "gray0"
82-
GRAY100 = "gray100"
101+
GRAY3 = "gray3"
102+
GRAY7 = "gray7"
83103
GRAY11 = "gray11"
84104
GRAY15 = "gray15"
85105
GRAY19 = "gray19"
86106
GRAY23 = "gray23"
87107
GRAY27 = "gray27"
88-
GRAY3 = "gray3"
89108
GRAY30 = "gray30"
90109
GRAY35 = "gray35"
91110
GRAY37 = "gray37"
@@ -100,7 +119,6 @@ class Color(StrEnum):
100119
GRAY63 = "gray63"
101120
GRAY66 = "gray66"
102121
GRAY69 = "gray69"
103-
GRAY7 = "gray7"
104122
GRAY70 = "gray70"
105123
GRAY74 = "gray74"
106124
GRAY78 = "gray78"
@@ -109,19 +127,20 @@ class Color(StrEnum):
109127
GRAY85 = "gray85"
110128
GRAY89 = "gray89"
111129
GRAY93 = "gray93"
130+
GRAY100 = "gray100"
112131
GREEN = "green"
113132
GREEN1 = "green1"
114133
GREEN3 = "green3"
115134
GREEN4 = "green4"
116135
GREEN_YELLOW = "green_yellow"
117136
GREY0 = "grey0"
118-
GREY100 = "grey100"
137+
GREY3 = "grey3"
138+
GREY7 = "grey7"
119139
GREY11 = "grey11"
120140
GREY15 = "grey15"
121141
GREY19 = "grey19"
122142
GREY23 = "grey23"
123143
GREY27 = "grey27"
124-
GREY3 = "grey3"
125144
GREY30 = "grey30"
126145
GREY35 = "grey35"
127146
GREY37 = "grey37"
@@ -136,7 +155,6 @@ class Color(StrEnum):
136155
GREY63 = "grey63"
137156
GREY66 = "grey66"
138157
GREY69 = "grey69"
139-
GREY7 = "grey7"
140158
GREY70 = "grey70"
141159
GREY74 = "grey74"
142160
GREY78 = "grey78"
@@ -145,6 +163,7 @@ class Color(StrEnum):
145163
GREY85 = "grey85"
146164
GREY89 = "grey89"
147165
GREY93 = "grey93"
166+
GREY100 = "grey100"
148167
HONEYDEW2 = "honeydew2"
149168
HOT_PINK = "hot_pink"
150169
HOT_PINK2 = "hot_pink2"

0 commit comments

Comments
 (0)