当前位置: 首页>>代码示例>>Python>>正文


Python Color.luminance方法代码示例

本文整理汇总了Python中colour.Color.luminance方法的典型用法代码示例。如果您正苦于以下问题:Python Color.luminance方法的具体用法?Python Color.luminance怎么用?Python Color.luminance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在colour.Color的用法示例。


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

示例1: generate_branding_style_secondary

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import luminance [as 别名]
    def generate_branding_style_secondary(self):
      styles = dict();

      if self.has_accent_color:
        accent = Color(self.safe_accent_color)
        accent.luminance = accent.luminance * 0.9 if accent.luminance * 0.9 >= 0 else 0;
        accent.saturation = accent.saturation * 1.1 if accent.saturation * 1.1 <= 1 else 1
        styles['background-color'] = accent.hex

      return self.css_style(styles);
开发者ID:urfonline,项目名称:website,代码行数:12,代码来源:models.py

示例2: _visualize_beacon

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import luminance [as 别名]
    def _visualize_beacon(self, data, beacon):
        if beacon == self.LEFT_BEACON:
            prefix = 'left_'
        else:
            prefix = 'right_'

        if not self.is_active_on_spectrum(data, prefix):
            return self.layout.set_beacon(beacon, self.layout._off)

        color = Color(rgb=self.container.get_conf(prefix + 'color'))
        color.luminance = self.container.get_conf(prefix + 'lum') / 100.0
        if self.config[beacon]['Luminance'] == 'Beat':
            color = self.beat_lum(data, color, prefix, beacon)
        elif self.config[beacon]['Luminance'] == 'Energy':
            color = self.energy_lum(data, color, prefix, beacon)
        elif self.config[beacon]['Luminance'] == 'Onset':
            color = self.onset_lum(data, color, prefix, beacon)

        if self.config[beacon]['Color'] == 'Beat':
            color = self.beat_color(data, color, prefix, beacon)
        elif self.config[beacon]['Color'] == 'Energy':
            color = self.energy_color(data, color, prefix, beacon)
        elif self.config[beacon]['Color'] == 'Onset':
            color = self.onset_color(data, color, prefix, beacon)

        if self.config[beacon]['Side'] == 'Beat':
            self.beat_side(data, color, prefix, beacon)
        elif self.config[beacon]['Side'] == 'Energy':
            self.energy_side(data, color, prefix, beacon)
        elif self.config[beacon]['Side'] == 'Onset':
            self.onset_side(data, color, prefix, beacon)
        elif self.config[beacon]['Row'] == 'Beat':
            self.beat_row(data, color, prefix, beacon)
        elif self.config[beacon]['Row'] == 'Energy':
            self.energy_row(data, color, prefix, beacon)
        elif self.config[beacon]['Row'] == 'Energy (R)':
            self.energy_row(data, color, prefix, beacon, reverse=True)
        elif self.config[beacon]['Row'] == 'Onset':
            self.onset_row(data, color, prefix, beacon)
        else:
            self.layout.set_beacon(beacon, color)
开发者ID:menthas,项目名称:prmd,代码行数:43,代码来源:custom.py

示例3: add_line

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import luminance [as 别名]
 def add_line(self, x, y, name='plot', xerr=None, yerr=None, linewidth=0.5,
              linestyle=None, linecolor='black', legend=True, axes=None):
     if axes is None:
         axes = self.ax
     self.plotnum = self.plotnum + 1
     if name is 'plot':
         name = 'plot%d' % (self.plotnum)
     if linestyle is None:
         _ls = self.linestyle[self.plotnum % 4]
     else:
         _ls = linestyle
     if xerr is None and yerr is None:
         line = axes.plot(x, y, label=name, color=linecolor,
                          marker=self.marker[self.plotnum % 7],
                          ls=_ls, lw=linewidth, solid_capstyle='butt',
                          clip_on=True)
         for i in range(0, len(line)):
             self.lines[name + '%d' % (i)] = (line[i])
     else:
         if linecolor == 'black':
             ecolor = '#A7A9AC'
         else:
             col = Color(linecolor)
             col.saturation = 0.5
             col.luminance = 0.75
             ecolor = col.hex
         line, caplines, barlinecols = axes.errorbar(x, y, label=name,
                                                     color=linecolor,
                                                     xerr=xerr,
                                                     yerr=yerr,
                                                     marker=self.marker[self.plotnum % 7],
                                                     ls=_ls,
                                                     ecolor=ecolor,
                                                     lw=linewidth,
                                                     clip_on=True)
         self.lines[name] = (line)
     self.markers_on()
     self.lines_off()
开发者ID:alexhagen,项目名称:pyg,代码行数:40,代码来源:twod.py

示例4: while

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import luminance [as 别名]
from colour import Color

input = []
while (len(input) < 49):
    input.extend(raw_input().split())

output = []
for color_text in input:
    c = Color(color_text)
    c.luminance = c.luminance / 2
    output.append(c.hex_l)

for _ in range(7):
    for _ in range(7):
        print output.pop(0) + " ",
    print
开发者ID:mungojelly,项目名称:7by7grid,代码行数:18,代码来源:darken.py

示例5: plot_conjugate_conics

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import luminance [as 别名]
def plot_conjugate_conics(ax, axes, width=None, plot_foci=False, plot_inverse_hyperbola=False):
    hyp, = ax.plot(*hyperbola(axes), color='dodgerblue', label='Hyperboloid (bundle of planes)')

    # Normal vector ellipse axes lengths
    # scales inversely\ with axes but can
    # be rescaled at will

    ax1,center = __inverse_ellipse(axes)

    if plot_inverse_hyperbola:
        # Plot inverse hyperbola
        color = Color('red')
        color.saturation = 0.8
        color.luminance = 0.85
        hyp_inv, = ax.plot(*hyperbola(1/axes, opens_up=True),
                            color=str(color), zorder=-1,
                           label='Inverse hyperboloid')

    ell, = ax.plot(*ellipse(ax1, center=[0,center]), color='red',
                label='Normal vector endpoint (fixed length)')

    ax.plot(*ellipse(axes), zorder=-5, color=hyp.get_color(),alpha=0.5, linewidth=1,
            label='Variance ellipsoid')


    if plot_foci:
        # Plot hyperbola focus
        hyp_c = N.sqrt(N.sum(axes**2))
        ax.plot([0,0],[hyp_c,-hyp_c], '.', color=hyp.get_color())

        # Plot ellipse foci
        c = ax1**2
        c.sort()
        c[0] *= -1
        ell_c = N.sqrt(N.sum(c))
        # Plot ellipse foci
        ax.plot([0,0],[center+ell_c,center-ell_c], '.', color=ell.get_color())

    # Plot tangents
    xvals = N.array([-500,500])
    yvals = axes[1]/axes[0]*xvals
    kw = dict(zorder=-1, color=hyp.get_color(), linewidth=0.5)
    ax.plot(xvals, yvals, ':', **kw, label='Hyperbolic tangents')
    ax.plot(xvals, -yvals, ':', **kw)

    #yvals = axes[0]/axes[1]*xvals
    kw = dict(zorder=-1, color=ell.get_color(), linewidth=0.5)
    ax.plot(yvals, xvals, ':', **kw, label='Normal vector tangents')
    ax.plot(yvals, -xvals, ':', **kw)

    _ = 4
    if axes[1] > 0.5*axes[0]:
        _ = 6

    if width is None:
        width = N.linalg.norm(axes)*_
    lim = N.array([-width,width])/2
    ax.set_xlim(lim)
    ax.set_ylim(lim*0.6)
    ax.set_aspect(1)

    return ax
开发者ID:davenquinn,项目名称:Attitude,代码行数:64,代码来源:parametric.py


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