mirror of
https://github.com/zadam/trilium.git
synced 2025-11-14 01:05:49 +01:00
allow overriding theme fonts
This commit is contained in:
33
src/routes/api/fonts.js
Normal file
33
src/routes/api/fonts.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const optionService = require('../../services/options');
|
||||
|
||||
function getFontCss(req, res) {
|
||||
res.setHeader('Content-Type', 'text/css');
|
||||
|
||||
if (!optionService.getOptionBool('overrideThemeFonts')) {
|
||||
res.send('');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const optionsMap = optionService.getOptionsMap();
|
||||
|
||||
// using body to be more specific than themes' :root
|
||||
res.send(`
|
||||
body {
|
||||
--main-font-family: ${optionsMap.mainFontFamily};
|
||||
--main-font-size: ${optionsMap.mainFontSize}%;
|
||||
|
||||
--tree-font-family: ${optionsMap.treeFontFamily};
|
||||
--tree-font-size: ${optionsMap.treeFontSize}%;
|
||||
|
||||
--detail-font-family: ${optionsMap.detailFontFamily};
|
||||
--detail-font-size: ${optionsMap.detailFontSize}%;
|
||||
|
||||
--monospace-font-family: ${optionsMap.monospaceFontFamily};
|
||||
--monospace-font-size: ${optionsMap.monospaceFontSize};
|
||||
}`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getFontCss
|
||||
};
|
||||
Reference in New Issue
Block a user