Skip to content

Commit 7fe6b0b

Browse files
committed
docs(readme): add details about new capabilities of .rgb method
1 parent cbf2840 commit 7fe6b0b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,23 @@ print(style.blue(1, 3.14, True, sep=", "))
8585
print(style.red(f"Hello {style.underline.on.blue('world')}!"))
8686
print(
8787
style.green(
88-
"I am a green line " +
89-
style.blue.underline.bold("with a blue substring") +
90-
" that becomes green again!"
88+
"I am a green line "
89+
+ style.blue.underline.bold("with a blue substring")
90+
+ " that becomes green again!"
9191
)
9292
)
9393

9494
# 24-bit RGB / hex and 256-color:
9595
print(style.rgb(123, 45, 200)("custom"))
96-
print(style.hex("#aabbcc")("hex is also supported"))
96+
print(style.rgb("#aabbcc")("hex is also supported"))
97+
print(style.rgb("purple")("as well as named colors too"))
9798
print(style.color256(37)("256-color example"))
9899

100+
# Note: previous versions of `coloredstrings` had a dedicated method
101+
# to accept hex color codes. It is now successfully handled by .rgb(...).
102+
# Do not use it - it's deprecated.
103+
print(style.hex("#aabbcc"))
104+
99105
# Define theme helpers:
100106
error = style.bold.red
101107
warning = style.hex("#FFA500")

examples/common_features.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@
2020

2121
# 24-bit RGB / hex and 256-color:
2222
print(style.rgb(123, 45, 200)("custom"))
23-
print(style.hex("#aabbcc")("hex is also supported"))
23+
print(style.rgb("#aabbcc")("hex is also supported"))
24+
print(style.rgb("purple")("as well as named colors too"))
2425
print(style.color256(37)("256-color example"))
2526

27+
# Note: previous versions of `coloredstrings` had a dedicated method
28+
# to accept hex color codes. It is now successfully handled by .rgb(...).
29+
# Do not use it - it’s deprecated.
30+
print(style.hex("#aabbcc"))
31+
2632
# Define theme helpers:
2733
error = style.bold.red
2834
warning = style.hex("#FFA500")

0 commit comments

Comments
 (0)