4 releases

0.1.3 Sep 28, 2024
0.1.2 Sep 27, 2024
0.1.1 Sep 27, 2024
0.1.0 Sep 26, 2024

#342 in GUI

Download history 275/week @ 2024-09-21 228/week @ 2024-09-28 7/week @ 2024-10-05 1/week @ 2024-10-12

160 downloads per month

MIT license

96KB
1.5K SLoC

Snowcap

Early stage markup for iced using pest

There is a simple viewer in bin/snowcap-viewer.rs with hot reloading. To run it, use cargo run samples/test.iced from the root of the project.

Here's an example of how the test.iced file renders.

Screenshot 2024-09-27 at 7 56 55 PM

Grammar

The grammar is specified in snowcap.pest and an example layout is in test.iced.

Iced Element Snowcap Syntax
Container {<attr:val,...> ...}
Row -<attr:val,...>[ element, ...]
Column |<attr:val,...>[ element, ...]
Stack ^<attr:val,...>[ element, ...]
Rule (horiz) rule-horizontal<height:2>()
Rule (vert) rule-vertical<width:2>()
Text text<attr:val,...>("Content")
Button button<attr:val,...>(element)
Toggler toggler<attr:val,...>(element)
QRCode qrcode<cell-size:10>(qr!("https://iced.rs"))
Markdown markdown(file!("README.md"))
Image image(file!("samples/ferris.png"))
Svg svg(file!("samples/coder.svg"))

For example, creating a container with a column would look like

{<width:"fill", align-x:"center">
	|<align:"center">[
		text<size:19>("Hello"),
		text<size:24>("Snowcap")
	]
}
Screenshot 2024-09-25 at 8 36 26 PM

Dependencies

~52–91MB
~1.5M SLoC