aboutsummaryrefslogtreecommitdiff
path: root/autoload/spectral.py
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/spectral.py')
-rw-r--r--autoload/spectral.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/autoload/spectral.py b/autoload/spectral.py
index f7903aa..9afcf6b 100644
--- a/autoload/spectral.py
+++ b/autoload/spectral.py
@@ -3,7 +3,7 @@ import os
import vim
import colormath
import colormath.color_diff
-from colormath.color_objects import LabColor, sRGBColor
+from colormath.color_objects import LabColor, sRGBColor, HSVColor
from colormath.color_conversions import convert_color
import sys
import math
@@ -423,6 +423,23 @@ def spectral_start(outfile):
spectral_ctx = Vivid(outfile)
spectral_ctx.start()
+def set_saturation(color, amnt):
+ if isinstance(color, str):
+ color = sRGBColor.new_from_rgb_hex(color)
+
+ print("Color " + str(color) + " " + get_rgb_hex(color))
+ color_hsv = convert_color(color, HSVColor)
+ (h, s, v) = color_hsv.get_value_tuple()
+
+ print("HSVPre " + str(color_hsv))
+ color_hsv = HSVColor(h, amnt, v)
+ print("HSVPost " + str(color_hsv))
+ return convert_color(color_hsv, sRGBColor)
+
+def spectral_set_saturation(color, amnt):
+ c = set_saturation(color, amnt)
+ vim.command('let g:return="%s"' % get_rgb_hex(c))
+
def lighter(color, amt):
if isinstance(color, str):