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


Python Color.saturation方法代码示例

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


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

示例1: generate_background

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import saturation [as 别名]
    def generate_background(self):
        hue_offset = promap(int(self.hash[14:][:3], 16), 0, 4095, 0, 359)
        sat_offset = int(self.hash[17:][:1], 16)
        base_color = Color(hsl=(0, .42, .41))
        base_color.hue = base_color.hue - hue_offset

        if sat_offset % 2:
            base_color.saturation = base_color.saturation + sat_offset / 100
        else:
            base_color.saturation = base_color.saturation - sat_offset / 100

        rgb = base_color.rgb
        r = int(round(rgb[0] * 255))
        g = int(round(rgb[1] * 255))
        b = int(round(rgb[2] * 255))
        return self.svg.rect(0, 0, '100%', '100%', **{
            'fill': 'rgb({}, {}, {})'.format(r, g, b)
        })
开发者ID:digvan,项目名称:geopatterns,代码行数:20,代码来源:geopatterns.py

示例2: generate_branding_style_secondary

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import saturation [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

示例3: add_line

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import saturation [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: plot_conjugate_conics

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import saturation [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.saturation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。