How to write bevy styles in JSON file.
Famiq supports almost all UI styles provided by Bevy engine.
id & Class
Famiq supports styles via id
and classes
.
{
"#my-widget-id": {
..
},
".some-class": {
..
}
}
class_name
must starts with dot.
.
For text widgets
-
color
: text color. Supports onlysrgba
,linear_rgba
andhsla
.Example,
"color": "srgba 0.961, 0, 0.784, 0.961"
https://docs.rs/bevy/latest/bevy/prelude/struct.TextColor.html
-
font_size
: text font size.Example,
"font_size": "14"
https://docs.rs/bevy/latest/bevy/prelude/struct.TextFont.html#structfield.font_size
Can be used for fa_text
and fa_fps
widgets.
For node widgets
-
background_color
: supports onlysrgba
,linear_rgba
andhsla
.Example,
"background_color": "srgba 0.961, 0, 0.784, 0.961"
https://docs.rs/bevy/latest/bevy/prelude/struct.BackgroundColor.html
-
border_color
: supports onlysrgba
,linear_rgba
andhsla
.Example,
"border_color": "linear_rgba 0.961, 0, 0.784, 0.961"
https://docs.rs/bevy/latest/bevy/prelude/struct.BorderColor.html
-
border_radius
: top_left, top_right, bottom_left, bottom_right.Example,
"border_radius": "10px 10px 10px 10px"
https://docs.rs/bevy/latest/bevy/prelude/struct.BorderRadius.html
-
border_radius_top_left
: this will override top_left value defined inborder_radius
. -
border_radius_top_right
: this will override top_right value defined inborder_radius
. -
border_radius_bottom_left
: this will override bottom_left value defined inborder_radius
. -
border_radius_bottom_right
: this will override bottom_right value defined inborder_radius
. -
visibility
: supports onlyvisible
,hidden
andinherited
.https://docs.rs/bevy/latest/bevy/prelude/enum.Visibility.html
-
z_index
: indicates that this Node entity’s front-to-back ordering is not controlled solely by its location in the UI hierarchy. A node with a higher z-index will appear on top of sibling nodes with a lower z-index.Example,
"z_index": "2"
-
display
: defines the layout model used by node. Supportsflex
,grid
,block
andnone
. -
position_type
: the strategy used to position node. Supportsrelative
andabsolute
.https://docs.rs/bevy/latest/bevy/prelude/enum.PositionType.html
-
overflow_x
: whether to show or clip overflowing items on the x axis. Supportsvisible
,clip
,hidden
andscroll
.https://docs.rs/bevy/latest/bevy/prelude/struct.Overflow.html
-
overflow_y
: whether to show or clip overflowing items on the y axis. Supportsvisible
,clip
,hidden
andscroll
.https://docs.rs/bevy/latest/bevy/prelude/struct.Overflow.html
-
left
: the horizontal position of the left edge of the node.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.left
-
right
: the horizontal position of the right edge of the node.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.right
-
top
: the vertical position of the top edge of the node.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.top
-
bottom
: the vertical position of the bottom edge of the node.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.bottom
-
width
: the ideal width of the node. width is used when it is within the bounds defined bymin_width
andmax_width
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.width
-
height
: the ideal height of the node. height is used when it is within the bounds defined bymin_height
andmax_height
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.height
-
min_width
: the minimumwidth
of the node.min_width
is used if it is greater thanwidth
and/ormax_width
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.min_width
-
min_height
: the minimumheight
of the node.min_height
is used if it is greater thanheight
and/ormax_height
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.min_height
-
max_width
: the maximumwidth
of the node.max_width
is used if it is within the bounds defined bymin_width
andwidth
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.max_width
-
max_height
: the maximumheight
of the node.max_height
is used if it is within the bounds defined bymin_height
andheight
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.max_height
-
align_items
: used to control how each individual item is aligned by default within the space they’re given. Supportsdefault
,start
,end
,flex_start
,flex_end
,center
,base_line
andstretch
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.align_items
-
justify_items
: used to control how each individual item is aligned by default within the space they’re given. Supportsdefault
,start
,end
,flex_start
,flex_end
,center
,base_line
andstretch
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.justify_items
-
align_left
: used to control how the specified item is aligned within the space it’s given. Supportsauto
,start
,end
,flex_start
,flex_end
,center
,base_line
andstretch
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.align_self
-
justify_content
: used to control how items are distributed. Supportsdefault
,start
,end
,flex_start
,flex_end
,center
,stretch
,space_between
,space_evenly
andspace_around
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.justify_content
-
margin
: left, right, top, bottom.Example,
"margin": "10px 10px 5px 5px"
https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.margin
-
margin_left
: this will override left value defined inmargin
. -
margin_right
: this will override right value defined inmargin
. -
margin_top
: this will override top value defined inmargin
. -
margin_bottom
: this will override bottom value defined inmargin
. -
padding
: left, right, top, bottom.Example,
"padding": "10px 10px 5px 5px"
https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.padding
-
padding_left
: this will override left value defined inpadding
. -
padding_right
: this will override right value defined inpadding
. -
padding_top
: this will override top value defined inpadding
. -
padding_bottom
: this will override bottom value defined inpadding
. -
border
: left, right, top, bottom.Example,
"padding": "10px 10px 5px 5px"
https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.border
-
border_left
: this will override left value defined inborder
. -
border_right
: this will override right value defined inborder
. -
border_top
: this will override top value defined inborder
. -
border_bottom
: this will override bottom value defined inborder
. -
flex_direction
: whether a Flexbox container should be a row or a column. Supportsrow
,column
,row_reverse
andcolumn_reverse
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.flex_direction
-
flex_wrap
: whether a Flexbox container should wrap its contents onto multiple lines if they overflow. Supportsno_wrap
,wrap
andwrap_reverse
.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.flex_wrap
-
flex_grow
: defines how much a flexbox item should grow if there’s space available. Defaults to "0" (don’t grow at all).https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.flex_grow
-
flex_shrink
: defines how much a flexbox item should shrink if there’s not enough space available. Defaults to 1.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.flex_shrink
-
flex_basis
: the initial length of a flexbox in the main axis, before flex growing/shrinking properties are applied.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.flex_basis
-
row_gap
: the size of the gutters between items in a vertical flexbox layout or between rows in a grid layout.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.row_gap
-
column_gap
: the size of the gutters between items in a horizontal flexbox layout or between column in a grid layout.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.column_gap
-
grid_auto_flow
: controls whether automatically placed grid items are placed row-wise or column-wise as well as whether the sparse or dense packing algorithm is used. Only affects Grid layouts.https://docs.rs/bevy/latest/bevy/prelude/struct.Node.html#structfield.grid_auto_flow