Hacker News new | past | comments | ask | show | jobs | submit login

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); })();




NOOOO! 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.


I think he shared this in case others want to use this to update their hn theme locally, not for hn to implement this...


Actually I wonder if I could implement that with the extension, that would be nice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: