mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
added palette global (#3984)
* Update docs/reference/src/language/builtins/globals.md Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * Update docs/reference/src/language/builtins/globals.md Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * Update docs/reference/src/language/builtins/globals.md Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * Update docs/reference/src/language/builtins/globals.md Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> * Update docs/reference/src/language/builtins/globals.md Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> --------- Co-authored-by: Florian Blasius <florian.blasius@slint-ui.com> Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev> Co-authored-by: Florian Blasius <flovansl@fedora.fritz.box>
This commit is contained in:
parent
5d9f824d90
commit
6da8120dfa
73 changed files with 593 additions and 266 deletions
|
@ -1,6 +1,45 @@
|
|||
<!-- Copyright © SixtyFPS GmbH <info@slint.dev> ; SPDX-License-Identifier: MIT -->
|
||||
# Builtin Global Singletons
|
||||
|
||||
## `Palette`
|
||||
|
||||
Use `Palette` to create custom widgets that match the colors of
|
||||
the selected style e.g. fluent, cupertino, material, or qt.
|
||||
|
||||
### Properties
|
||||
|
||||
- **`background`** (_out_ _brush_): Defines the default background brush. Use this if none of the more specialised background brushes apply.
|
||||
- **`foreground`** (_out_ _brush_): Defines the foreground brush that is used for content that is displayed on `background` brush.
|
||||
- **`alternate-background`** (_out_ _brush_): Defines an alternate background brush that is used for example for text input controls or panels like a side bar.
|
||||
- **`alternate-foreground`** (_out_ _brush_): Defines the foreground brush that is used for content that is displayed on `alternate-background` brush.
|
||||
- **`control-background`** (_out_ _brush_): Defines the default background brush for controls, such as push buttons, combo boxes, etc.
|
||||
- **`control-foreground`** (_out_ _brush_): Defines the foreground brush that is used for content that is displayed on `control-background` brush.
|
||||
- **`accent-background`** (_out_ _brush_): Defines the background brush for highlighted controls such as primary buttons.
|
||||
- **`accent-foreground`** (_out_ _brush_): Defines the foreground brush that is used for content that is displayed on `accent-background` brush.
|
||||
- **`selection-background`** (_out_ _brush_): Defines the background brush that is used to highlight a selection such as a text selection.
|
||||
- **`selection-foreground`** (_out_ _brush_): Defines the foreground brush that is used for content that is displayed on `selection-background` brush.
|
||||
- **`border`** (_out_ _brush_): Defines the brush that is used for borders such as separators and widget borders.
|
||||
|
||||
### Example
|
||||
|
||||
```slint
|
||||
import { Palette, HorizontalBox } from "std-widgets.slint";
|
||||
|
||||
export component MyCustomWidget {
|
||||
in property <string> text <=> label.text;
|
||||
|
||||
Rectangle {
|
||||
background: Palette.control-background;
|
||||
|
||||
HorizontalBox {
|
||||
label := Text {
|
||||
color: Palette.control-foreground;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## `TextInputInterface`
|
||||
|
||||
The `TextInputInterface.text-input-focused` property can be used to find out if a `TextInput` element has the focus.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue