Skip to content

Is it possible to change the font size with the keyboard #3431

Answered by t-fritsch
ChoCho66 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

As mentioned in https://revealjs.com/keyboard/ you can add/edit keyboard shortcut quite easily.

Font sizes in reveal are controlled by a main css variable named --r-main-font-size :

--r-main-font-size: #{$mainFontSize};

then overriding this variable value on a DOM node will automatically change font-sizes in every children. If you do so on body element, you then control the whole font sizes. This snippet should do the trick :

function updateFontSize( delta ) {
    const fontSizeRegexp = /^(?<size>\d+)(?<unit>\D*)$/, // the beauty of named capturing groups 😍
        fontSize = getComputedStyle( Reveal.getView…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by t-fritsch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants