Add none value for colors -> tabs.indicator.system.
This commit is contained in:
parent
857a70ded7
commit
f614e5b98a
@ -41,6 +41,8 @@ Added
|
|||||||
* `completion -> scrollbar-padding`
|
* `completion -> scrollbar-padding`
|
||||||
* `colors -> completion.scrollbar.fg`
|
* `colors -> completion.scrollbar.fg`
|
||||||
* `colors -> completion.scrollbar.bg`
|
* `colors -> completion.scrollbar.bg`
|
||||||
|
- New value `none` for `colors -> tabs.indicator.system` to not display a
|
||||||
|
gradient for tab indicators.
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -644,12 +644,14 @@ class ColorSystem(MappingType):
|
|||||||
special = True
|
special = True
|
||||||
valid_values = ValidValues(('rgb', "Interpolate in the RGB color system."),
|
valid_values = ValidValues(('rgb', "Interpolate in the RGB color system."),
|
||||||
('hsv', "Interpolate in the HSV color system."),
|
('hsv', "Interpolate in the HSV color system."),
|
||||||
('hsl', "Interpolate in the HSL color system."))
|
('hsl', "Interpolate in the HSL color system."),
|
||||||
|
('none', "Don't show a gradient."))
|
||||||
|
|
||||||
MAPPING = {
|
MAPPING = {
|
||||||
'rgb': QColor.Rgb,
|
'rgb': QColor.Rgb,
|
||||||
'hsv': QColor.Hsv,
|
'hsv': QColor.Hsv,
|
||||||
'hsl': QColor.Hsl,
|
'hsl': QColor.Hsl,
|
||||||
|
'none': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,12 +164,20 @@ def interpolate_color(start, end, percent, colorspace=QColor.Rgb):
|
|||||||
percent: Which value to get (0 - 100)
|
percent: Which value to get (0 - 100)
|
||||||
colorspace: The desired interpolation color system,
|
colorspace: The desired interpolation color system,
|
||||||
QColor::{Rgb,Hsv,Hsl} (from QColor::Spec enum)
|
QColor::{Rgb,Hsv,Hsl} (from QColor::Spec enum)
|
||||||
|
If None, start is used except when percent is 100.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
The interpolated QColor, with the same spec as the given start color.
|
The interpolated QColor, with the same spec as the given start color.
|
||||||
"""
|
"""
|
||||||
qtutils.ensure_valid(start)
|
qtutils.ensure_valid(start)
|
||||||
qtutils.ensure_valid(end)
|
qtutils.ensure_valid(end)
|
||||||
|
|
||||||
|
if colorspace is None:
|
||||||
|
if percent == 100:
|
||||||
|
return end
|
||||||
|
else:
|
||||||
|
return start
|
||||||
|
|
||||||
out = QColor()
|
out = QColor()
|
||||||
if colorspace == QColor.Rgb:
|
if colorspace == QColor.Rgb:
|
||||||
a_c1, a_c2, a_c3, _alpha = start.getRgb()
|
a_c1, a_c2, a_c3, _alpha = start.getRgb()
|
||||||
|
@ -844,6 +844,8 @@ class TestColorSystem:
|
|||||||
'hsv': QColor.Hsv,
|
'hsv': QColor.Hsv,
|
||||||
'HSL': QColor.Hsl,
|
'HSL': QColor.Hsl,
|
||||||
'hsl': QColor.Hsl,
|
'hsl': QColor.Hsl,
|
||||||
|
'none': None,
|
||||||
|
'None': None,
|
||||||
'': None,
|
'': None,
|
||||||
}
|
}
|
||||||
INVALID = ['RRGB', 'HSV ', ''] # '' is invalid with none_ok=False
|
INVALID = ['RRGB', 'HSV ', ''] # '' is invalid with none_ok=False
|
||||||
|
@ -338,6 +338,17 @@ class TestInterpolateColor:
|
|||||||
expected.setHsl(0, 30, 150)
|
expected.setHsl(0, 30, 150)
|
||||||
assert Color(color) == expected
|
assert Color(color) == expected
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('percentage, expected', [
|
||||||
|
(0, (0, 0, 0)),
|
||||||
|
(99, (0, 0, 0)),
|
||||||
|
(100, (255, 255, 255)),
|
||||||
|
])
|
||||||
|
def test_interpolation_none(self, percentage, expected):
|
||||||
|
"""Test an interpolation with a gradient turned off."""
|
||||||
|
color = utils.interpolate_color(Color(0, 0, 0), Color(255, 255, 255),
|
||||||
|
percentage, None)
|
||||||
|
assert Color(color) == Color(*expected)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('seconds, out', [
|
@pytest.mark.parametrize('seconds, out', [
|
||||||
(-1, '-0:01'),
|
(-1, '-0:01'),
|
||||||
|
Loading…
Reference in New Issue
Block a user