dropped: theme choice feature

This commit is contained in:
quenousimporte 2023-10-10 17:11:39 +02:00
parent dec2c48393
commit abf5cf46c1
2 changed files with 8 additions and 149 deletions

View File

@ -8,11 +8,6 @@
<link rel="manifest" href="manifest.json" /> <link rel="manifest" href="manifest.json" />
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://fonts.cdnfonts.com/css/inconsolata-2">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Droid+Serif" />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack-subset.css'>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Josefin+Sans" />
</head> </head>
<body onload="init()" onkeydown="mainkeydownhandler()" onresize="resize()" onstorage="loadstorage()"> <body onload="init()" onkeydown="mainkeydownhandler()" onresize="resize()" onstorage="loadstorage()">

152
main.js
View File

@ -1,18 +1,17 @@
var defaultsettings = var defaultsettings =
{ {
bgcolor: "white", bgcolor: "white",
fontfamily: "ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'", fontfamily: "monospace",
fontsize: "16px", fontsize: "14px",
fontcolor: "rgb(55,53,47)", fontcolor: "black",
lineheight: "24px", lineheight: "130%",
accentcolor: "rgb(55,53,47)", accentcolor: "#5AA7CE",
margins: "7%", margins: "20%",
savedelay: 2000, savedelay: 2000,
defaultpreviewinsplit: false, defaultpreviewinsplit: false,
tagautocomplete: false, tagautocomplete: false,
titleinaccentcolor: false, titleinaccentcolor: false,
enablenetwork: false, enablenetwork: true,
titlebydefault: false, titlebydefault: false,
linksinnewtab: true, linksinnewtab: true,
colors: true, colors: true,
@ -53,109 +52,6 @@ var stat =
} }
} }
var themes =
{
mingwdark:
{
bgcolor: "rgb(46,52,64)",
fontfamily: "Lucida console",
fontsize: "14px",
fontcolor: "rgb(191,191,191)",
lineheight: "120%",
accentcolor: "rgb(177,54,186)"
},
mingw64:
{
bgcolor: "white",
fontfamily: "Lucida console",
fontsize: "13px",
fontcolor: "black",
lineheight: "110%",
accentcolor: "rgb(177,54,186)"
},
Default:
{
bgcolor: "white",
fontfamily: "monospace",
fontsize: "14px",
fontcolor: "black",
lineheight: "130%",
accentcolor: "#5AA7CE"
},
Notion:
{
bgcolor: "white",
fontfamily: "ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, 'Apple Color Emoji', Arial, sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol'",
fontsize: "16px",
fontcolor: "rgb(55,53,47)",
lineheight: "24px",
accentcolor: "rgb(55,53,47)"
},
Monkey:
{
bgcolor: "rgb(227,227,227)",
fontfamily: "'Hack', 'Consolas', monospace",
fontsize: "14px",
fontcolor: "rgb(55,55,55)",
lineheight: "24px",
accentcolor: "#5AA7CE"
},
"White monkey":
{
bgcolor: "white",
fontfamily: "'Inconsolata', 'Consolas', monospace",
fontsize: "18px",
fontcolor: "black",
lineheight: "150%",
accentcolor: "#5AA7CE"
},
Mariana:
{
bgcolor: "rgb(48,56,65)",
fontfamily: "'Consolas', monospace",
fontsize: "16px",
fontcolor: "rgb(216,222,233)",
lineheight: "120%",
accentcolor: "rgb(249,174,88)"
},
"Plus plus":
{
bgcolor: "white",
fontfamily: "'Consolas', 'Courier New', monospace",
fontsize: "15px",
fontcolor: "black",
lineheight: "110%",
accentcolor: "rgb(128,0,255)"
},
Calmly:
{
bgcolor: "rgb(250,250,250)",
fontfamily: "'Droid Serif', serif",
fontsize: "19px",
fontcolor: "rgb(60,60,60)",
lineheight: "28.5px",
accentcolor: "rgb(60,60,60)"
},
Breakers:
{
bgcolor: "rgb(252,253,253)",
fontfamily: "'Consolas', monospace",
fontsize: "16px",
fontcolor: "rgb(50,50,50)",
lineheight: "120%",
accentcolor: "rgb(95,180,180)"
},
Cryptee:
{
bgcolor: "white",
fontfamily: "'Josefin Sans', sans-serif",
fontsize: "16px",
fontcolor: "rgb(78,78,78)",
lineheight: "24px",
accentcolor: "rgb(54,54,54)"
}
};
var commands = [ var commands = [
{ {
hint: "Close menu" hint: "Close menu"
@ -289,11 +185,6 @@ var commands = [
action: addtagfilter, action: addtagfilter,
shortcut: "ctrl+shift+F", shortcut: "ctrl+shift+F",
}, },
{
hint: "Select theme",
action: selecttheme,
allowunsaved: true
},
{ {
hint: "Show info", hint: "Show info",
action: showinfo, action: showinfo,
@ -620,31 +511,11 @@ function showinfo()
].join("\n")); ].join("\n"));
} }
function loadtheme(theme)
{
for (var i in themes[theme])
{
settings[i] = themes[theme][i];
}
applystyle();
applycolors();
resize();
}
function savesettings() function savesettings()
{ {
window.localStorage.setItem("settings", JSON.stringify(settings)); window.localStorage.setItem("settings", JSON.stringify(settings));
} }
function selecttheme()
{
searchinlist(Object.keys(themes), loadtheme)
.then(t =>
{
loadtheme(t);
savesettings();
});
}
function addtagfilter() function addtagfilter()
{ {
@ -2106,8 +1977,7 @@ function applycolors()
return; return;
} }
var boldstyle = "-webkit-text-stroke-width: 0.5px;"; var boldstyle = "font-weight: bold;";
var lines = md.value.split("\n"); var lines = md.value.split("\n");
var header = false; var header = false;
var code = false; var code = false;
@ -2319,12 +2189,6 @@ function showhelp()
help.push("[jszip](https://stuk.github.io/jszip/)"); help.push("[jszip](https://stuk.github.io/jszip/)");
help.push("[FileSaver](http://eligrey.com)"); help.push("[FileSaver](http://eligrey.com)");
help.push("## Fonts");
help.push("[Inconsolata](https://levien.com/type/myfonts/inconsolata.html)");
help.push("[Hack](https://sourcefoundry.org/hack/)");
help.push("[Droid Serif](https://fonts.adobe.com/fonts/droid-serif)");
help.push("[Josefin Sans](https://fonts.google.com/specimen/Josefin+Sans)");
help.push("## Inspiration"); help.push("## Inspiration");
help.push("[rwtxt](https://rwtxt.com)"); help.push("[rwtxt](https://rwtxt.com)");
help.push("[Offline Notepad](https://offlinenotepad.com/)"); help.push("[Offline Notepad](https://offlinenotepad.com/)");