-def fg(name: Optional[str] = "",
- red: Optional[int] = None,
- green: Optional[int] = None,
- blue: Optional[int] = None,
- *,
- force_16color: bool = False,
- force_216color: bool = False) -> str:
+@logging_utils.squelch_repeated_log_messages(1)
+def fg(
+ name: Optional[str] = "",
+ red: Optional[int] = None,
+ green: Optional[int] = None,
+ blue: Optional[int] = None,
+ *,
+ force_16color: bool = False,
+ force_216color: bool = False,
+) -> str:
+ """Return the ANSI escape sequence to change the foreground color
+ being printed. Target colors may be indicated by name or R/G/B.
+ Result will use the 16 or 216 color scheme if force_16color or
+ force_216color are passed (respectively). Otherwise the code will
+ do what it thinks best.
+
+ >>> import string_utils as su
+ >>> su.to_base64(fg('blue'))
+ b'G1szODs1OzIxbQ==\\n'
+
+ """
+ import string_utils
+
+ if name is not None and name == 'reset':
+ return '\033[39m'
+