mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Updated documentation to 0.4.0
This commit is contained in:
@@ -9,6 +9,7 @@ In component API documentation, you can find the style API for this component. O
|
||||
|
||||
## Usage
|
||||
Setup default druid style for all druid instances via `druid.set_default_style`
|
||||
You can pass _nil_ or _empty_table_ to use default values for all components (no styles)
|
||||
```lua
|
||||
local druid = require("druid.druid")
|
||||
local my_style = require("my.amazing.style")
|
||||
@@ -41,3 +42,18 @@ local function init(self)
|
||||
self.button:set_style(my_style)
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
## Create your own styles
|
||||
|
||||
The most components have their styles. You can explore it on [Druid API](https://insality.github.io/druid/) in table style section ([button example](https://insality.github.io/druid/modules/druid.button.html#Style)). Or you can see, what fields component uses in code in function `on_style_change`
|
||||
|
||||
To create you style, create lua module, what return <_component_name_, _component_style_> table
|
||||
|
||||
Example: [default druid style](https://github.com/Insality/druid/blob/develop/druid/styles/default/style.lua)
|
||||
|
||||
Override all fields you want and set your style with one of next ways:
|
||||
|
||||
- Set your style as global via `druid.set_default_style`
|
||||
- Set style for concrete druid instance via `druid = druid.new(self, style)`
|
||||
- Set style for concrete instance via `component:set_style(style)`
|
Reference in New Issue
Block a user