Skip to content

UI.Style

Name - Description Default Type
<input>
<output>
OverrideTextStyle If set this will change the default TextStyle for all widgets. None TextStyle&TextStyleString&String
FontId If set this will change the font family and size for all widgets. None {Any}&{Any}
TextStyles The FontFamily and size you want to use for a specific TextStyle. None {Any}&{Any}
DragValueTextStyle The style to use for DragValue text. None TextStyle&TextStyleString&String
Wrap If set, labels buttons wtc will use this to determine whether or not to wrap the text at the right edge of the Ui they are in. None Bool
AnimationTime How many seconds a typical animation should last. None Float&Float
ExplanationTooltips Show tooltips explaining DragValues etc when hovered. None Bool
ResizeGrabRadiusSide Mouse must be this close to the side of a window to resize None Float&Float
ResizeGrabRadiusCorner Mouse must be this close to the corner of a window to resize None Float&Float
ShowTooltipsOnlyWhenStill If false, tooltips will show up anytime you hover anything, even is mouse is still moving None Bool
ItemSpacing Horizontal and vertical spacing between widgets. None Float2&Float2
WindowMargin Horizontal and vertical margins within a window frame. None Float4&Float4
ButtonPadding Button size is text size plus this on each side None Float2&Float2
MenuMargin Horizontal and vertical margins within a menu frame. None Float4&Float4
Indent Indent collapsing regions etc by this much. None Float&Float
InteractSize Minimum size of a DragValue, color picker button, and other small widgets. interact_size.y is the default height of button, slider, etc. Anything clickable should be (at least) this size. None Float2&Float2
SliderWidth Default width of a Slider. None Float&Float
ComboWidth Default (minimum) width of a ComboBox. None Float&Float
TextEditWidth Default width of a TextEdit. None Float&Float
IconWidth Checkboxes, radio button and collapsing headers have an icon at the start. This is the width/height of the outer part of this icon (e.g. the BOX of the checkbox). None Float&Float
IconWidthInner Checkboxes, radio button and collapsing headers have an icon at the start. This is the width/height of the inner part of this icon (e.g. the check of the checkbox). None Float&Float
IconSpacing Checkboxes, radio button and collapsing headers have an icon at the start. This is the spacing between the icon and the text None Float&Float
TooltipWidth Width of a tooltip (on_hover_ui, on_hover_text etc). None Float&Float
IndentEndsWithHorizontalLine End indented regions with a horizontal line None Bool
ComboHeight Height of a combo-box before showing scroll bars. None Float&Float
ScrollBarWidth Width of a scroll bar. None Float&Float
ScrollHandleMinLength Make sure the scroll handle is at least this big None Float&Float
ScrollBarInnerMargin Margin between contents and scroll bar. None Float&Float
ScrollBarOuterMargin Margin between scroll bar and the outer container (e.g. right of a vertical scroll bar). None Float&Float
DarkMode If true, the visuals are overall dark with light text. If false, the visuals are overall light with dark text. None Bool&Bool
OverrideTextColor Override default text color for all text. None Color&Color
Selection None {Any}&{Any}
HyperlinkColor The color used for Hyperlink None Color&Color
FaintBgColor Something just barely different from the background color. Used for Grid::striped. None Color&Color
ExtremeBgColor Very dark or light color (for corresponding theme). Used as the background of text edits, scroll bars and others things that needs to look different from other interactive stuff. None Color&Color
CodeBgColor Background color behind code-styled monospaced labels. None Color&Color
WarnFgColor A good color for warning text (e.g. orange). None Color&Color
ErrorFgColor A good color for error text (e.g. red). None Color&Color
WindowRounding Window corner rounding. None Float4&Float4
WindowShadow Window shadow size. None {Any}&{Any}
WindowFill Window background color. None Color&Color
WindowStroke Window stroke (border) color and thickness. None {Any}&{Any}
MenuRounding Menu corner rounding. None Float4&Float4
PanelFill Panel background color. None Color&Color
PopupShadow Popup shadow size. None {Any}&{Any}
ResizeCornerSize Corner rounding for resize handle rects. None Float&Float
TextCursorWidth Width of the line cursor when hovering over InputText etc. None Float&Float
TextCursorPreview Show where the text cursor would be if you clicked. None Bool&Bool
ClipRectMargin Allow child widgets to be just on the border and still have a stroke with some thickness None Float&Float
ButtonFrame Show a background behind buttons. None Bool&Bool
CollapsingHeaderFrame Show a background behind collapsing headers. None Bool&Bool
IndentHasLeftVLine Draw a vertical lien left of indented region, in e.g. CollapsingHeader. None Bool&Bool
Striped Whether or not Grids and Tables should be striped by default (have alternating rows differently colored). None Bool&Bool
SliderTrailingFill Show trailing color behind the circle of a Slider. Default is OFF. Enabling this will affect ALL sliders, and can be enabled/disabled per slider with Slider::trailing_fill. None Bool&Bool

Apply style changes to the current UI scope.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(GFX.MainWindow
 :Contents
 (->
  (Setup
   (GFX.DrawQueue) >= .ui-draw-queue
   (GFX.UIPass .ui-draw-queue) >> .render-steps)
  (UI
   .ui-draw-queue
   (UI.CentralPanel
    :Contents
    (->
     (UI.Style
      :OverrideTextStyle "MyStyle"
      :TextStyles {:MyStyle {:Size 36.0
                             :Family FontFamily.Monospace}})
     "Hello Shards!" (UI.Label)

     (UI.Style :TextStyles {:MyStyle {:Size 16.0 :Family FontFamily.Monospace}})
     "Hello Shards!" (UI.Label)

     (UI.Style :TextStyles {:MyStyle {:Size 20.0 :Family FontFamily.Proportional}})
     "Hello Shards!" (UI.Label)

    ;;  (UI.Style :TextStyles {:MyStyle {:Size 24.0 :Family FontFamily.Monospace}})
    ;;  (UI.Button "Button")
     ;
     )))

  (GFX.Render :Steps .render-steps)))

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(GFX.MainWindow
 :Contents
 (->
  (Setup
   (GFX.DrawQueue) >= .ui-draw-queue
   (GFX.UIPass .ui-draw-queue) >> .render-steps)
  (UI
   .ui-draw-queue
   (UI.CentralPanel
    (->
     (Setup
      64 >= .hue
      0 >= .r >= .g
      (color 0 0 0 0) >= .color
      16.0 >= .size)

     255 (Math.Subtract .hue) (Math.Multiply 2) (Min 255) > .r
     .hue (Math.Multiply 2) (Min 255) > .g
     [.r .g 0 255] (ToColor) > .color

     (UI.Scope
      (->
       (UI.Style
        :OverrideTextStyle "MyStyle"
        :TextStyles {:MyStyle {:Size .size
                               :Family FontFamily.Monospace}}
        :OverrideTextColor .color)
       (UI.IntSlider
        :Variable .hue
        :Min 0 :Max 255)
       (UI.FloatSlider
        :Variable .size
        :Min 8.0 :Max 96.0)
       "Hello Shards!" (UI.Label)))

     "This text is not affected" (UI.Label))))

  (GFX.Render :Steps .render-steps)))