39 lines
1.8 KiB
Text
39 lines
1.8 KiB
Text
|
|
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||
|
|
|
||
|
|
;; bjogui/examples/styles.bjo — styles, classes and the dark theme.
|
||
|
|
;;
|
||
|
|
;; bjo run examples/styles.bjo
|
||
|
|
;;
|
||
|
|
;; The picture in the Readme is this program, taken with
|
||
|
|
;;
|
||
|
|
;; BJOGUI_SCREENSHOT=docs/styles.png bjo run examples/styles.bjo
|
||
|
|
(import (std prelude))
|
||
|
|
(import (bjogui view))
|
||
|
|
(import (bjogui app))
|
||
|
|
|
||
|
|
(type (: Msg (Union Nothing)))
|
||
|
|
|
||
|
|
(defun (main)
|
||
|
|
(run-app 0 (fun (msg n) (next n))
|
||
|
|
(fun (n)
|
||
|
|
(column #:spacing 12.0 #:margin 20.0
|
||
|
|
(classed (text "Styled with classes") "title")
|
||
|
|
(row #:spacing 8.0
|
||
|
|
(classed (button "Save" Nothing) "primary")
|
||
|
|
(classed (button "Delete" Nothing) "danger")
|
||
|
|
(button "Plain" Nothing))
|
||
|
|
(classed (border (text "a card") #:padding 10.0) "card")
|
||
|
|
(toggle-switch "Dark mode" #t (fun (b) Nothing))
|
||
|
|
(number-input 3.0 (fun (d) Nothing) #:width 160.0)
|
||
|
|
(date-picker "2026-10-25" (fun (d) Nothing))))
|
||
|
|
#:theme (fun (n) "dark")
|
||
|
|
#:styles (list (style "text" #:class "title" #:font-size 22.0 #:colour "#f1c40f")
|
||
|
|
(style "button" #:class "primary" #:background "#27ae60" #:colour "white"
|
||
|
|
#:hover-background "#2ecc71" #:pressed-background "#1e8449")
|
||
|
|
(style "button" #:class "danger" #:background "#c0392b" #:colour "white"
|
||
|
|
#:hover-background "#e74c3c" #:radius 12.0)
|
||
|
|
(style "border" #:class "card" #:background "#34495e" #:radius 8.0))
|
||
|
|
#:title "styles" #:width 360.0 #:height 330.0))
|