-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adjustments to match Sublime 4069 which now handles HSL color blending correctly. - Handle HSL if a user use the 'deg' unit type - Sublime doesn't support them, but support 'rad', 'grad', and 'turn' unit types in case Sublime ever supports them in HSL an HWB.
- Loading branch information
1 parent
2d4e9cd
commit 3d6c3cf
Showing
5 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,14 @@ | |
RGBA. | ||
Licensed under MIT | ||
Copyright (c) 2012 - 2020 Isaac Muse <[email protected]> | ||
Copyright (c) 2012 - 2016 Isaac Muse <[email protected]> | ||
""" | ||
import re | ||
from colorsys import rgb_to_hls, hls_to_rgb, rgb_to_hsv, hsv_to_rgb | ||
import decimal | ||
import sublime | ||
|
||
HSL_WORKAROUND = int(sublime.version()) < 4069 | ||
|
||
RGB_CHANNEL_SCALE = 1.0 / 255.0 | ||
HUE_SCALE = 1.0 / 360.0 | ||
|
@@ -54,8 +57,10 @@ def hue_blend_channel(c1, c2, f): | |
c1 += 360.0 | ||
else: | ||
c2 += 360.0 | ||
# This shouldn't be necessary and is probably a bug in Sublime. | ||
f = 1.0 - f | ||
|
||
if HSL_WORKAROUND: | ||
# This shouldn't be necessary and is probably a bug in Sublime. | ||
f = 1.0 - f | ||
|
||
value = abs(c1 * f + c2 * (1 - f)) | ||
while value > 360.0: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters