vlaaad / reveal

Read Eval Visualize Loop for Clojure
https://vlaaad.github.io/reveal/
MIT License
600 stars 21 forks source link

[FEATURE] Look and feel customization #6

Closed onetom closed 4 years ago

onetom commented 4 years ago

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

vlaaad commented 4 years ago

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.

practicalli-johnny commented 4 years ago

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/

vlaaad commented 4 years ago

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

seancorfield commented 4 years ago

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?

vlaaad commented 4 years ago

Done, see UI preferences section in the readme.

seancorfield commented 4 years ago

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