Skip to content

Commit 21cb57a

Browse files
authored
Figure.pygmtlogo: Simplify the code logic for defining colors (#4629)
1 parent 9a91164 commit 21cb57a

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

pygmt/src/pygmtlogo.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
__doctest_skip__ = ["pygmtlogo"]
1818

1919

20-
def _create_logo( # noqa: PLR0915, PLR0912
20+
def _create_logo( # noqa: PLR0915
2121
shape: Literal["circle", "hexagon"] = "circle",
2222
theme: Literal["light", "dark"] = "light",
2323
wordmark: Literal["none", "horizontal", "vertical"] = "none",
@@ -49,25 +49,18 @@ def _create_logo( # noqa: PLR0915, PLR0912
4949
# Define colors
5050
color_light = "white"
5151
color_dark = "gray20"
52-
52+
# Blue, yellow, and red colors
5353
blue = "48/105/152" # Python blue
5454
yellow = "255/212/59" # Python yellow
5555
red = "238/86/52" # GMT red
5656
if not color:
57-
blue = yellow = red = color_dark
58-
if theme == "dark":
59-
blue = yellow = red = color_light
60-
57+
mono = color_dark if theme == "light" else color_light
58+
blue = yellow = red = mono
6159
# Background and wordmark
62-
match theme:
63-
case "light":
64-
color_bg = color_light
65-
color_py = blue
66-
color_gmt = color_dark
67-
case "dark":
68-
color_bg = color_dark
69-
color_py = yellow
70-
color_gmt = color_light
60+
color_bg, color_py, color_gmt = {
61+
"light": (color_light, blue, color_dark),
62+
"dark": (color_dark, yellow, color_light),
63+
}[theme]
7164

7265
# Define shape
7366
match shape:

0 commit comments

Comments
 (0)