Color class green_color property

This page explains the Color class green_color property.

What property is this?

The green_color property returns or sets a green color ap.Int value.

This value takes the range from 0 to 255.

Basic usage

The following example shows how to use the green_color getter and setter interfaces:

import apysc as ap

stage: ap.Stage = ap.Stage(
    stage_width=0,
    stage_height=0,
    background_color=ap.Color("#333"),
    stage_elem_id="stage",
)

color: ap.Color = ap.Color("#aa00ff")
green_color: ap.Int = color.green_color
ap.assert_equal(green_color, 0)

color = ap.Color("#00ffaa")
green_color = color.green_color
ap.assert_equal(green_color, 255)

color.green_color = ap.Int(0)
green_color = color.green_color
ap.assert_equal(green_color, 0)

color.green_color = ap.Int(255)
green_color = color.green_color
ap.assert_equal(green_color, 255)

ap.save_overall_html(dest_dir_path="./green_color_basic_usage/")

green_color property API

Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.

[Interface summary]

Get a green color integer value (0 to 255).


[Returns]

  • green_color: Int

    • Green color integer value (0 to 255).


[Examples]

>>> import apysc as ap
>>> _ = ap.Stage(
...     background_color=ap.Color("#333"),
...     stage_elem_id="stage",
... )
>>> color: ap.Color = ap.Color("#aa00ff")
>>> green_color: ap.Int = color.green_color
>>> green_color
Int(0)

>>> color = ap.Color("#00ffaa")
>>> green_color = color.green_color
>>> green_color
Int(255)

>>> color.green_color = ap.Int(0)
>>> green_color = color.green_color
>>> green_color
Int(0)

>>> color.green_color = ap.Int(255)
>>> green_color = color.green_color
>>> green_color
Int(255)