MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / Darken

Function Darken

gui/utils/color.py:18–33  ·  view source on GitHub ↗

Darkens a Color using a factor between 0 and 1

(color, factor)

Source from the content-addressed store, hash-verified

16
17
18def Darken(color, factor):
19 """ Darkens a Color using a factor between 0 and 1"""
20 r, g, b, a = color
21
22 factor = min(max(factor, 0), 1)
23 factor = 1 - factor
24
25 r *= factor
26 g *= factor
27 b *= factor
28
29 r = min(max(r, 0), 255)
30 b = min(max(b, 0), 255)
31 g = min(max(g, 0), 255)
32
33 return wx.Colour(round(r), round(g), round(b), round(a))
34
35
36def _getBrightness(color):

Callers 1

GetSuitableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected