本文整理汇总了Python中colormath.color_objects.RGBColor.get_value_tuple方法的典型用法代码示例。如果您正苦于以下问题:Python RGBColor.get_value_tuple方法的具体用法?Python RGBColor.get_value_tuple怎么用?Python RGBColor.get_value_tuple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类colormath.color_objects.RGBColor
的用法示例。
在下文中一共展示了RGBColor.get_value_tuple方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scaled_rgb
# 需要导入模块: from colormath.color_objects import RGBColor [as 别名]
# 或者: from colormath.color_objects.RGBColor import get_value_tuple [as 别名]
def scaled_rgb(hex_color, component=None, factor=1.0):
rgb_color = RGBColor()
rgb_color.set_from_rgb_hex(hex_color)
values = list(map(lambda x: factor * (x / 255), rgb_color.get_value_tuple()))
if component is None:
return '{} {} {}'.format(*rgb_color.get_value_tuple())
else:
comp_idx = ('R', 'G', 'B').index(component)
return '{}'.format(values[comp_idx])
示例2: db_insert
# 需要导入模块: from colormath.color_objects import RGBColor [as 别名]
# 或者: from colormath.color_objects.RGBColor import get_value_tuple [as 别名]
def db_insert(filename, url, palette, rssid):
if db[COLLECTION].find({'opedid':filename}).count() > 0:
return
doc = {}
doc['opedid'] = filename
doc['url'] = url
# rgbs = []
labs = []
prominences = []
for color in palette.colors:
# rgbs.append(list(color.value))
prominences.append(color.prominence)
lab_color = RGBColor(*color.value).convert_to('lab')
labs.append(list(lab_color.get_value_tuple()))
# Rotate arrays
# rgbs = zip(*rgbs)
labs = zip(*labs)
#doc['r'] = rgbs[0]
#doc['g'] = rgbs[1]
#doc['b'] = rgbs[2]
doc['l'] = labs[0]
doc['a'] = labs[1]
doc['b'] = labs[2]
doc['prominence'] = prominences
doc['rssid'] = rssid
db[COLLECTION].insert(doc, safe=True)
示例3: raw_rgb
# 需要导入模块: from colormath.color_objects import RGBColor [as 别名]
# 或者: from colormath.color_objects.RGBColor import get_value_tuple [as 别名]
def raw_rgb(hex_color):
rgb_color = RGBColor()
rgb_color.set_from_rgb_hex(hex_color)
return '{} {} {}'.format(*rgb_color.get_value_tuple())