Skip to content

Commit

Permalink
release candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
jNaimXIII committed Oct 10, 2022
1 parent 968dfff commit a2228d4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# VoidTab
![](docs/images/VoidTab-banner-dark.png#gh-dark-mode-only)
![](docs/images/VoidTab-banner-light.png#gh-light-mode-only)

A void new-tab extension.
A void / blank page for your browser's New Tab page. Tired of annoying items and menus in your home screen? Try VoidTab.
It literally is a blank page with a solid background. You can customize that background to match your browser theme.
4 changes: 4 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { config } from "./config.js";

// Set colors to default values.
const baseSetup = () => {
chrome.storage.sync.set({ colors: config.colors });
};

// On load, check if `colors` exist.
chrome.storage.sync.get(["colors"], (colors) => {
// Initialize with base colors if not set.
if (!Object.keys(colors).length) baseSetup();
});

// Restore default values on event.
chrome.runtime.onMessage.addListener((message) => {
if (message === "reset-colors") baseSetup();
});
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const config = {
// Default background colors.
colors: {
darkBackground: "#313131",
lightBackground: "#f1f1f1",
Expand Down
Binary file added docs/images/VoidTab-banner-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/VoidTab-banner-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions popup/popup.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
const colorInputFormelement = document.getElementById("color-input-form");
const colorInputFormElement = document.getElementById("color-input-form");
const darkColorInputElement = document.getElementById("dark-color-input");
const lightColorInputElement = document.getElementById("light-color-input");
const resetColorsButtonElement = document.getElementById("reset-colors-button");

// Set page backgrounds from storage values.
chrome.storage.sync.get(["colors"], (result) => {
const colors = result.colors;

darkColorInputElement.value = colors.darkBackground;
lightColorInputElement.value = colors.lightBackground;
});

colorInputFormelement.onsubmit = (event) => {
// Update storage values from form data.
colorInputFormElement.onsubmit = (event) => {
event.preventDefault();

const darkBackground = darkColorInputElement.value;
Expand All @@ -24,6 +26,7 @@ colorInputFormelement.onsubmit = (event) => {
chrome.storage.sync.set({ colors });
};

// Dispatch `reset-colors` event handled by `background.js`.
resetColorsButtonElement.onclick = () => {
chrome.runtime.sendMessage("reset-colors");
};

0 comments on commit a2228d4

Please sign in to comment.