vlaaad / reveal

Read Eval Visualize Loop for Clojure

Home Page:https://vlaaad.github.io/reveal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Look and feel customization

onetom opened this issue · comments

The very first thing I missed right after starting reveal is to change its font size, then its font, then its color scheme to something light.
Shall we use this issue to discuss the possible avenues how to achieve this?

This SO thread suggests that JavaFX already has some theming capabilities, so we might "just" need to hook that in:
https://stackoverflow.com/questions/28474914/javafx-css-themes

Hi! I think someone asked me about this before, and I am planning to add it in the future. Reveal uses code-driven styling where CSS is generated from the small number of color and size definitions. I think I'll add a way to side-load those definitions to allow different themes, and maybe provide a light theme by default.

Changing font and its size will also be possible, although changing them in runtime will require some work — current implementation caches some text bounds information in data structures.

As quick hack I clone the repository and used a :local/root to use my custom hacks on the project.
~/.clojure/deps.edn

  :repl-reveal-local
  {:extra-deps {vlaaad/reveal {:local/root "/home/practicalli/projects/clojure/visualization/reveal/"}}
   :main-opts  ["-m" "vlaaad.reveal" "repl"]}

On a 1920x1080 screen (Ubuntu Linux, Java 11) a font size setting of 24 seems comfortable to view, higher than expected.
src/vlaaad/reveal/font.clj

(def ^javafx.scene.text.Font font
  (javafx.scene.text.Font/loadFont
    (io/input-stream
      (io/resource "vlaaad/reveal/FantasqueSansMono-Regular.ttf")) 24.0))

Edit: I am only changing the font size so I can use reveal in video screencasts and live broadcasts until JavaFX theming or other mechanism is available to customize the font size. Hopefully a light theme is available that would complement the videos I create on https://practicalli.github.io/

Hold on a little longer, I'm starting to work on this feature 😆

I was just about to ask for font size control (at startup), via a JVM property perhaps? So it can easily be set via aliases?

Done, see UI preferences section in the readme.

Very nice! Bumped the font size up to 18 and my poor old eyes can actually read Reveal's output easily now -- thank you!