spectacle icon indicating copy to clipboard operation
spectacle copied to clipboard

Support CodePane font change

Open asm0dey opened this issue 3 years ago • 0 comments

Description

Currently, fonts used in CodePane are hardcoded into the themes.

Proposal

I propose to support customizing of them may be the same way we can customize other fonts now

Links / References

Currently I've written dirty hack to monkey patch it in runtime,

import codeTheme from 'react-syntax-highlighter/dist/cjs/styles/prism/material-dark';

const changeFont = obj => {
    if (typeof obj === 'object') {
        for (const keys in obj) {
            if (typeof obj[keys] === 'object') {
                changeFont(obj[keys])
            } else {
                if (keys==="fontFamily"){
                    obj[keys] = '"JetBrains Mono", monospace'
                }
            }
        }
    }
    return obj;
};
changeFont(codeTheme)

But of course, it's not how it should be done.

asm0dey avatar Sep 29 '21 06:09 asm0dey