* Tools: Remove the unecessary 'FF' from generated colors
When colors in most UI tools are 100% alpha the extra 'FF' is auto cut
off for readability. e.g. #000000FF becomes #000000. Since introducing
the new color pickers this has been the case on the UI side. However the
code generator for gradients was inconsistent and would still add in the
unnecessary 'FF'. This fixes that and makes generated gradient code
tidier.
* Fix correct tests
* Fix
* [autofix.ci] apply automated fixes
* Fix
* Fix
* Fix
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
`__1` is a valid identifier, which we normalized to
`--1`, which is invalid.
This changes the nromalization function to leave a `_` in the first position.
* interpreter: Support gradients in JSON conversion
Add gradients to the list of types that can be read from
JSON and serialized to JSON.
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
We can now set all the properties exposed to the
business logic of a UI we are previewing.
Simple properties only so far, everything else falls
back to JSON data.
Next step is to add more sophisticated UI to actually
edit more complex data like arrays more graphically.
Extract the `from_json` and `to_json` code from the viewer into the `interpreter`.
Extend the `from_json` and `to_json` a bit. Add some simple tests while at it.