mirror of https://github.com/kivy/kivy.git
doc: Added doc for color property setting in init
This commit is contained in:
parent
5eb0aa6c28
commit
417ca16365
|
@ -183,7 +183,12 @@ cdef class Color(ContextInstruction):
|
||||||
# using hsv mode + alpha
|
# using hsv mode + alpha
|
||||||
c = Color(0, 1, 1, .2, mode='hsv')
|
c = Color(0, 1, 1, .2, mode='hsv')
|
||||||
|
|
||||||
In kv lang::
|
You can also set color components that are available as properties
|
||||||
|
by passing them as keyword arguments::
|
||||||
|
|
||||||
|
c = Color(b=0.5) # sets the blue component only
|
||||||
|
|
||||||
|
In kv lang you can set the color properties directly::
|
||||||
|
|
||||||
<Rule>:
|
<Rule>:
|
||||||
canvas:
|
canvas:
|
||||||
|
@ -229,7 +234,7 @@ cdef class Color(ContextInstruction):
|
||||||
'rgb', 'rgba', 'hsv',
|
'rgb', 'rgba', 'hsv',
|
||||||
'h', 's', 'v']:
|
'h', 's', 'v']:
|
||||||
if property_name in kwargs:
|
if property_name in kwargs:
|
||||||
setattr(self, property_name, kwargs['property_name'])
|
setattr(self, property_name, kwargs[property_name])
|
||||||
|
|
||||||
property rgba:
|
property rgba:
|
||||||
'''RGBA color, list of 4 values in 0-1 range.
|
'''RGBA color, list of 4 values in 0-1 range.
|
||||||
|
|
Loading…
Reference in New Issue