MCPcopy
hub / github.com/ArtifexSoftware/pdf2docx / rgb_value

Function rgb_value

pdf2docx/common/share.py:182–200  ·  view source on GitHub ↗

Gray/RGB/CMYK mode components to color value.

(components:list)

Source from the content-addressed store, hash-verified

180
181
182def rgb_value(components:list):
183 '''Gray/RGB/CMYK mode components to color value.'''
184 num = len(components)
185 # CMYK mode
186 if num==4:
187 c, m, y, k = map(float, components)
188 color = cmyk_to_rgb(c, m, y, k, cmyk_scale=1.0)
189 # RGB mode
190 elif num==3:
191 r, g, b = map(float, components)
192 color = rgb_to_value([r, g, b])
193 # gray mode
194 elif num==1:
195 g = float(components[0])
196 color = rgb_to_value([g,g,g])
197 else:
198 color = 0
199
200 return color
201
202
203# -------------------------

Callers 7

collect_stream_linesMethod · 0.85
finalizeMethod · 0.85
set_char_shadingFunction · 0.85
to_strokesMethod · 0.85
to_strokesMethod · 0.85
to_fillMethod · 0.85
_parse_text_formatMethod · 0.85

Calls 2

cmyk_to_rgbFunction · 0.85
rgb_to_valueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…