3 ms·
This is code for an extension I run locally. const getAttributes = () => { let head = document.head || document.getElementsByTagName("head")[0]; return {
by badrchoubai 6y ago
This is code for an extension I run locally.
const getAttributes = () => {
let head = document.head || document.getElementsByTagName("head")[0];
return {
head,
};
};
const changeStyles = (targetElement) => {
style = document.createElement("style");
// set style.innerHTML to darker colors, append to head
style.type = "text/css";
style.innerHTML = `
body, #hnmain { background: #272822; }
a.storylink, a.morelink, span.commtext { color: #fff; }
a.storylink:visited { color: #444444; }
`;
targetElement.appendChild(style);
};
(function main() {
const { ...attributes } = getAttributes();
changeStyles(attributes.head);
})();
- fermienrico 6y agoNOOOO! Why not a check box in the profile page? There is already a place for changing the colors. Can we please not add any javascript? The server remembers my topbar color. It can remember a boolean flag too.
- jypepin 6y agoI think he shared this in case others want to use this to update their hn theme locally, not for hn to implement this...
- badrchoubai 6y agoActually I wonder if I could implement that with the extension, that would be nice.