Coder Social home page Coder Social logo

justin-carver / pinterdark Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 2.0 25 KB

A simple Firefox extension that allows custom CSS to be injected into Pinterest to allow for an accessible yet modern dark theme on Pinterest domains.

License: GNU General Public License v3.0

CSS 80.44% JavaScript 19.56%
css pinterest dark dark-theme dark-mode firefox firefox-addon firefox-extension

pinterdark's Introduction

Pinterdark

Pinterest Logo Black

Author: Justin Carver

Published on: Firefox Add-on Store

Stack: Pure JS / CSS

License: GPL-3

A simple Firefox extension that allows custom CSS to be injected into Pinterest to allow for an accessible yet modern dark theme on Pinterest domains. (does not affect Pinterest sub-domains!)

Pinterest Dark Mode


I was completely bewildered to find out that Pinterest doesn't offer a native desktop dark mode, yet encourages users to use the mobile application which does support dark mode, sometimes I need a bigger screen to be more creative! Heading over to the Pinterest home page will burn your cornea if it's past 9PM.

This extension is a very simple, straight-forward, lightweight (2kb!) CSS override for Pinterest on desktop to give your tired eyes a break when creating your new story or reference board.

Please Note: I will update this extension occasionally as time progresses. Some things may break over this course of time, but I'll be sure to keep an eye on it. If you have any recommendations, or would like to add anything, submit a PR and I'll take a look at it.

Thanks!

- Justin

Technicals

  • I am unsure at this time if these will need to be rewritten if Pinterest updates their back-end and class names reset!
  • #555 and #333 were the to "bread-and-butter" colors selected for this theme, they pair great and are light on the eyes. In the future, I may expand this to select custom colors for themes, for now these are hard-coded.
  • There is a custom pinterdark.css file that contains the overrides for the auto-generated classes on Pinterest's web pages.
  • There are some DOM elements that could not be styled without affecting every other element on the page as well. I wanted to avoid injecting custom classes on different element, this is supposed to be a simple extension, so some items are not as perfect as I would like them to be. This is only a few lines of code.

This is the entire code. It simply will create a new stylesheet link, point it to the pinterdark.css file, then append it to the head element on any page within the *://www.pinterest.com/* domain. You may see a brief flicker of white from the previous stylesheet being applied before this is rendered, but will stay cached between page visits. It seems to occur on new sessions only.

var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', browser.runtime.getURL('css/pinterdark.css'));
document.head.appendChild(link);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.