MCPcopy
hub / github.com/pandas-dev/pandas / _convert_hex_to_excel

Method _convert_hex_to_excel

pandas/io/formats/excel.py:478–483  ·  view source on GitHub ↗
(self, color_string: str)

Source from the content-addressed store, hash-verified

476 return bool(color_string.startswith("#"))
477
478 def _convert_hex_to_excel(self, color_string: str) -> str:
479 code = color_string.lstrip("#")
480 if self._is_shorthand_color(color_string):
481 return (code[0] * 2 + code[1] * 2 + code[2] * 2).upper()
482 else:
483 return code.upper()
484
485 def _is_shorthand_color(self, color_string: str) -> bool:
486 """Check if color code is shorthand.

Callers 1

color_to_excelMethod · 0.95

Calls 3

_is_shorthand_colorMethod · 0.95
lstripMethod · 0.80
upperMethod · 0.80

Tested by

no test coverage detected