summaryrefslogtreecommitdiffstats
path: root/src/curve.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-05 16:50:36 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-05 16:50:36 +0200
commit991fa9e6781d51642090913a4f213b7fe643896d (patch)
treed94873fb15e940ea1d57c40e2d34eeab65fd06c9 /src/curve.py
parentadd constants with colour temperatures (diff)
downloadblueshift-991fa9e6781d51642090913a4f213b7fe643896d.tar.gz
blueshift-991fa9e6781d51642090913a4f213b7fe643896d.tar.bz2
blueshift-991fa9e6781d51642090913a4f213b7fe643896d.tar.xz
m + add support for naming (as a string) a colour temperature constant
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/curve.py')
-rw-r--r--src/curve.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/curve.py b/src/curve.py
index 7efb26e..24e7330 100644
--- a/src/curve.py
+++ b/src/curve.py
@@ -59,7 +59,7 @@ def temperature(temperature, algorithm):
'''
Change colour temperature according to the CIE illuminant series D using CIE sRBG
- @param temperature:float The blackbody temperature in kelvins
+ @param temperature:float|str The blackbody temperature in kelvins, or a name
@param algorithm:(float)→(float, float, float) Algorithm for calculating a white point, for example `cmf_10deg`
'''
rgb_temperature(temperature, algorithm)
@@ -69,9 +69,11 @@ def rgb_temperature(temperature, algorithm):
'''
Change colour temperature according to the CIE illuminant series D using CIE sRBG
- @param temperature:float The blackbody temperature in kelvins
+ @param temperature:float|str The blackbody temperature in kelvins, or a name
@param algorithm:(float)→(float, float, float) Algorithm for calculating a white point, for example `cmf_10deg`
'''
+ # Resolve colour temperature name
+ temperature = kelvins(temperature) # TODO demo and document this and add to textconf and lisp-esque
# Do nothing if the temperature is neutral
if temperature == 6500: return
# Otherwise manipulate the colour curves
@@ -82,9 +84,11 @@ def cie_temperature(temperature, algorithm):
'''
Change colour temperature according to the CIE illuminant series D using CIE xyY
- @param temperature:float The blackbody temperature in kelvins
+ @param temperature:float|str The blackbody temperature in kelvins, or a name
@param algorithm:(float)→(float, float, float) Algorithm for calculating a white point, for example `cmf_10deg`
'''
+ # Resolve colour temperature name
+ temperature = kelvins(temperature)
# Do nothing if the temperature is neutral
if temperature == 6500: return
# Otherwise manipulate the colour curves