• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.interpolate_color函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qutebrowser.utils.interpolate_color函数的典型用法代码示例。如果您正苦于以下问题:Python interpolate_color函数的具体用法?Python interpolate_color怎么用?Python interpolate_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了interpolate_color函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_valid_percentages_hsl

 def test_valid_percentages_hsl(self):
     """Test 0% and 100% in the HSL colorspace."""
     white = utils.interpolate_color(self.white, self.black, 0, QColor.Hsl)
     black = utils.interpolate_color(self.white, self.black, 100,
                                     QColor.Hsl)
     assert Color(white) == self.white
     assert Color(black) == self.black
开发者ID:skinnay,项目名称:qutebrowser,代码行数:7,代码来源:test_utils.py


示例2: test_0_100

 def test_0_100(self, colors, colorspace):
     """Test 0% and 100% in different colorspaces."""
     white = utils.interpolate_color(colors.white, colors.black, 0,
                                     colorspace)
     black = utils.interpolate_color(colors.white, colors.black, 100,
                                     colorspace)
     assert Color(white) == colors.white
     assert Color(black) == colors.black
开发者ID:phansch,项目名称:qutebrowser,代码行数:8,代码来源:test_utils.py


示例3: test_valid_percentages_hsv

 def test_valid_percentages_hsv(self, colors):
     """Test 0% and 100% in the HSV colorspace."""
     white = utils.interpolate_color(colors.white, colors.black, 0,
                                     QColor.Hsv)
     black = utils.interpolate_color(colors.white, colors.black, 100,
                                     QColor.Hsv)
     assert Color(white) == colors.white
     assert Color(black) == colors.black
开发者ID:eknowledger,项目名称:qutebrowser,代码行数:8,代码来源:test_utils.py


示例4: test_interpolation_hsl

 def test_interpolation_hsl(self):
     """Test an interpolation in the HSL colorspace."""
     start = Color()
     stop = Color()
     start.setHsl(0, 40, 100)
     stop.setHsl(0, 20, 200)
     color = utils.interpolate_color(start, stop, 50, QColor.Hsl)
     expected = Color()
     expected.setHsl(0, 30, 150)
     assert Color(color) == expected
开发者ID:phansch,项目名称:qutebrowser,代码行数:10,代码来源:test_utils.py


示例5: test_interpolation_none

 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 isinstance(color, QColor)
     assert Color(color) == Color(*expected)
开发者ID:phansch,项目名称:qutebrowser,代码行数:6,代码来源:test_utils.py


示例6: test_interpolation_rgb

 def test_interpolation_rgb(self):
     """Test an interpolation in the RGB colorspace."""
     color = utils.interpolate_color(Color(0, 40, 100), Color(0, 20, 200),
                                     50, QColor.Rgb)
     assert Color(color) == Color(0, 30, 150)
开发者ID:phansch,项目名称:qutebrowser,代码行数:5,代码来源:test_utils.py


示例7: test_invalid_colorspace

 def test_invalid_colorspace(self, colors):
     """Test an invalid colorspace."""
     with pytest.raises(ValueError):
         utils.interpolate_color(colors.white, colors.black, 10,
                                 QColor.Cmyk)
开发者ID:phansch,项目名称:qutebrowser,代码行数:5,代码来源:test_utils.py


示例8: test_invalid_percentage

 def test_invalid_percentage(self, colors, perc):
     """Test an invalid percentage."""
     with pytest.raises(ValueError):
         utils.interpolate_color(colors.white, colors.white, perc)
开发者ID:phansch,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py


示例9: test_invalid_end

 def test_invalid_end(self, colors):
     """Test an invalid end color."""
     with pytest.raises(qtutils.QtValueError):
         utils.interpolate_color(colors.white, Color(), 0)
开发者ID:phansch,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py


示例10: test_invalid_start

 def test_invalid_start(self, colors):
     """Test an invalid start color."""
     with pytest.raises(qtutils.QtValueError):
         utils.interpolate_color(Color(), colors.white, 0)
开发者ID:phansch,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py


示例11: test_invalid_percentage

 def test_invalid_percentage(self):
     """Test an invalid percentage."""
     with pytest.raises(ValueError):
         utils.interpolate_color(self.white, self.white, -1)
     with pytest.raises(ValueError):
         utils.interpolate_color(self.white, self.white, 101)
开发者ID:vyp,项目名称:qutebrowser,代码行数:6,代码来源:test_utils.py



注:本文中的qutebrowser.utils.interpolate_color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.is_enum函数代码示例发布时间:2022-05-26
下一篇:
Python utils.format_size函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap