(executables
- (public_names index style))
+ (public_names index style)
+ (libraries html))
(install
(files
* along with this website. If not, see <https://www.gnu.org/licenses/>.
*)
-Printf.printf "%s"
- {|@media (prefers-color-scheme: light) {
-body {
- background-color: #ffc;
- color: #000;
-}
-a {
- color: #099;
-}
-a:visited {
- color: #c3c;
-}
-}
-@media (prefers-color-scheme: dark) {
-body {
- background-color: #003;
- color: #fff;
-}
-a {
- color: #ff9;
-}
-a:visited {
- color: #f99;
-}
-}
+open Html
-#content {
- min-height: calc(100vh - 200px);
-}
+let colorscheme ~scheme ~fg ~bg ~link ~used_link =
+ let open CSS in
+ media ~feature:("prefers-color-scheme", scheme)
+ [
+ block [tag "body"] [property "background-color" ("#" ^ bg); property "color" ("#" ^ fg)];
+ block [tag "a"] [property "color" ("#" ^ link)];
+ block [tag "a:visited"] [property "color" ("#" ^ used_link)];
+ ]
-#mpring {
- margin-left: calc(50% - 100px);
- border: 0;
-}
-|}
+let () =
+ let open CSS in
+ CSS.print
+ [
+ colorscheme ~scheme:"light" ~fg:"000" ~bg:"ffc" ~link:"099" ~used_link:"c3c";
+ colorscheme ~scheme:"dark" ~fg:"fff" ~bg:"003" ~link:"ff9" ~used_link:"f99";
+ block [id "content"] [property "min-height" "calc(100vh - 200px)"];
+ block [id "mpring"] [property "margin-left" "calc(50% - 100px)"; property "border" "0"];
+ ]
--- /dev/null
+(* f4mnq.fr
+ * Copyright 2026 Amélia COUTARD-SANDER <https://www.f4mnq.fr>.
+
+ * This website is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+
+ * This website is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+ * for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this website. If not, see <https://www.gnu.org/licenses/>.
+ *)
+
+type t = string -> unit
+
+type selector = string
+
+type property = string -> unit
+
+let print = List.iter (fun f -> f "")
+
+let media ~feature:(n, v) blocks indent =
+ Printf.printf "%s@media (%s: %s) {\n" indent n v;
+ List.iter (fun f -> f indent) blocks;
+ Printf.printf "%s}\n" indent
+
+let block selectors properties indent =
+ Printf.printf "%s%s {\n" indent (String.concat " " selectors);
+ List.iter (fun f -> f @@ indent ^ "\t") properties;
+ Printf.printf "%s}\n" indent
+
+let tag s = s
+
+let id s = "#" ^ s
+
+let property name value indent = Printf.printf "%s%s: %s;\n" indent name value
--- /dev/null
+(* f4mnq.fr
+ * Copyright 2026 Amélia COUTARD-SANDER <https://www.f4mnq.fr>.
+
+ * This website is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+
+ * This website is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+ * for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this website. If not, see <https://www.gnu.org/licenses/>.
+ *)
+
+type t
+
+type selector
+
+type property
+
+val print : t list -> unit
+
+val media : feature:string * string -> t list -> t
+
+val block : selector list -> property list -> t
+
+val tag : string -> selector
+
+val id : string -> selector
+
+val property : string -> string -> property
--- /dev/null
+(library
+ (name html))