Skip to content

Commit

Permalink
Merge pull request #3 from misa198/code-color-theme
Browse files Browse the repository at this point in the history
Code color theme
  • Loading branch information
misa198 authored Feb 19, 2022
2 parents caca0e3 + 97fff50 commit d814e0c
Show file tree
Hide file tree
Showing 57 changed files with 8,284 additions and 677 deletions.
38 changes: 20 additions & 18 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
MIT License
Copyright (c) 2022 misa198<Thanh Vu>
Copyright (c) GitHub Dark authors
All rights reserved.

Copyright (c) 2021 Thanh Vu <misa198>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
Octotree Icon Theme
</h1>
<p align="center">
<a href="https://microsoftedge.microsoft.com/addons/detail/octotree-icon-theme/cajppifioefokdcmnbehbkiddjnpmadb">
<a href="https://microsoftedge.microsoft.com/addons/detail/cajppifioefokdcmnbehbkiddjnpmadb">
<img src="https://img.shields.io/badge/Microsoft%20Edge%20Store-Download-blue" />
</a>
<a href="https://addons.mozilla.org/vi/firefox/addon/octotree-icon-theme/">
<a href="https://addons.mozilla.org/vi/firefox/addon/octotree-theme/">
<img src="https://img.shields.io/badge/Firefox%20Addons-Download-orange" />
</a>
<a href="https://github.com/misa198/octotree-icon-theme/releases">
<img src="https://img.shields.io/github/v/release/misa198/octotree-icon-theme" />
<a href="https://github.com/misa198/octotree-theme/releases">
<img src="https://img.shields.io/github/v/release/misa198/octotree-theme" />
</a>
<a href="https://www.octotree.io/download">
<img src="https://img.shields.io/badge/install-Octotree-orange" />
Expand All @@ -21,29 +21,38 @@ Octotree Icon Theme

## Overview

A Browser Extension which gives different filetypes different icons to GitHub and Octotree for free.
A browser extension which gives different filetypes different icons, and code color theme to GitHub and Octotree for free.

Support Chromium Browsers and Firefox.

<p align="center">
<img src="./docs/screenshot-main.png" />
<img src="./docs/screenshot-1.png" />
</p>
<br />
<p align="center">
<img src="./docs/screenshot-2.png" />
</p>

## Installation

- For Microsoft Edge Chromium

[ <img src="https://img.shields.io/badge/Microsoft_Edge-0078D7?style=for-the-badge&logo=Microsoft-edge&logoColor=white" /> ](https://microsoftedge.microsoft.com/addons/detail/octotree-icon-theme/cajppifioefokdcmnbehbkiddjnpmadb)
[ <img src="https://img.shields.io/badge/Microsoft_Edge-0078D7?style=for-the-badge&logo=Microsoft-edge&logoColor=white" /> ](https://microsoftedge.microsoft.com/addons/detail/cajppifioefokdcmnbehbkiddjnpmadb)

- For Firefox

[ <img src="https://img.shields.io/badge/Firefox_Browser-FF7139?style=for-the-badge&logo=Firefox-Browser&logoColor=white" /> ](https://addons.mozilla.org/vi/firefox/addon/octotree-icon-theme/)
[ <img src="https://img.shields.io/badge/Firefox_Browser-FF7139?style=for-the-badge&logo=Firefox-Browser&logoColor=white" /> ](https://addons.mozilla.org/vi/firefox/addon/octotree-theme/)

- For other Chromium browser:
<br>
Download from <a href="https://github.com/misa198/octotree-icon-theme/releases">
Download from <a href="https://github.com/misa198/octotree-theme/releases">
here
</a> and follow the instructions [here](https://www.quora.com/How-do-I-install-a-chrome-extension-from-a-zip-file).

## Credits

- [@StylishThemes](https://github.com/StylishThemes) for [GitHub Dark](https://github.com/StylishThemes/GitHub-Dark/)

## License

[MIT](./LICENSE)
[BSD 2-Clause "Simplified" License](./LICENSE)
1 change: 0 additions & 1 deletion docs/microsoft-edge.svg

This file was deleted.

Binary file added docs/screenshot-1.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/screenshot-2.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 removed docs/screenshot-main.png
Binary file not shown.
28 changes: 17 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
{
"name": "octotree-icon-theme",
"description": "A Browser Extension which gives different filetypes different icons to GitHub and Octotree for free.",
"license": "MIT",
"name": "octotree-theme",
"description": "A Browser Extension which gives different filetypes different icons, and code color theme to GitHub and Octotree for free.",
"license": "BSD-2-Clause Simplified License",
"author": "Thanh Vu <misa198>",
"homepage": "https://github.com/misa198/octotree-icon-theme#readme",
"homepage": "https://github.com/misa198/octotree-theme#readme",
"repository": {
"type": "git",
"url": "https://github.com/misa198/octotree-icon-theme/tree/master"
"url": "https://github.com/misa198/octotree-theme/tree/master"
},
"bugs": {
"url": "https://github.com/misa198/octotree-icon-theme/issues"
"url": "https://github.com/misa198/octotree-theme/issues"
},
"version": "1.2.1",
"version": "1.3.0",
"scripts": {
"pre-commit": "lint-staged",
"build:firefox": "rm -rf build/firefox && cross-env NODE_ENV=firefox webpack --config webpack.config.js --display-error-details --progress --colors",
"build:chromium": "rm -rf build/chromium && cross-env NODE_ENV=chromium webpack --config webpack.config.js --display-error-details --progress --colors",
"build": "npm run build:firefox && npm run build:chromium",
"build:firefox": "rm -rf build/firefox && cross-env PLATFORM=firefox webpack --config webpack.config.js --display-error-details --progress --colors",
"build:chromium": "rm -rf build/chromium && cross-env PLATFORM=chromium webpack --config webpack.config.js --display-error-details --progress --colors",
"build": "npm run build:chromium && npm run build:firefox",
"lint": "eslint src/**/*.ts",
"lint:fix": "npm run lint -- --fix"
"lint:fix": "npm run lint -- --fix",
"generate-code-themes": "node tools/generate.js && prettier --write src/scripts/constants"
},
"dependencies": {
"capitalize": "^2.0.4",
"dom-loaded": "^2.0.0",
"file-icons-js": "^1.1.0",
"is-mobile": "^3.0.0",
"node-sass": "^4.9.4",
"sass-loader": "^7.2.0",
"select-dom": "^7.1.1",
"selector-observer": "^2.1.6",
"webext-domain-permission-toggle": "^2.1.0",
"webext-dynamic-content-scripts": "^7.1.1",
"webext-options-sync": "^2.0.1"
},
"devDependencies": {
"@types/capitalize": "^2.0.0",
"@types/chrome": "^0.0.134",
"@types/css-font-loading-module": "^0.0.4",
"@types/firefox-webext-browser": "^94.0.1",
"@types/node": "^17.0.18",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"clean-webpack-plugin": "^3.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/platforms/manifest.chromium.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"manifest_version": 2,
"name": "Octotree Icon Theme",
"author": "misa198",
"homepage_url": "https://github.com/misa198/octotree-icon-theme",
"homepage_url": "https://github.com/misa198/octotree-theme",
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": ["https://github.com/*"],
"matches": ["https://github.com/*", "https://gist.github.com/*"],
"js": ["content.js"],
"css": ["content.css"],
"run_at": "document_start"
Expand All @@ -20,8 +20,8 @@
"128": "icons/icon128.png"
},
"browser_action": {
"default_icon": "icons/icon64.png",
"default_popup": "popup.html"
"default_icon": "icons/icon64-disabled.png",
"default_popup": "popup-disabled.html"
},
"content_security_policy": "script-src 'self'; object-src 'self'",
"web_accessible_resources": ["*.woff2"],
Expand Down
8 changes: 4 additions & 4 deletions src/platforms/manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"manifest_version": 2,
"name": "Octotree Icon Theme",
"author": "misa198",
"homepage_url": "https://github.com/misa198/octotree-icon-theme",
"homepage_url": "https://github.com/misa198/octotree-theme",
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": ["https://github.com/*"],
"matches": ["https://github.com/*", "https://gist.github.com/*"],
"js": ["content.js"],
"css": ["content.css"],
"run_at": "document_start"
Expand All @@ -20,8 +20,8 @@
"128": "icons/icon128.png"
},
"browser_action": {
"default_icon": "icons/icon64.png",
"default_popup": "popup.html"
"default_icon": "icons/icon64-disabled.png",
"default_popup": "popup-disabled.html"
},
"content_security_policy": "script-src 'self'; object-src 'self'",
"web_accessible_resources": ["*.woff2"],
Expand Down
2 changes: 2 additions & 0 deletions src/popup-disabled.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
display: flex;
justify-content: center;
align-items: center;
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',
Roboto, 'Helvetica Neue', Arial, sans-serif;
}
</style>
<body>
Expand Down
15 changes: 10 additions & 5 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,34 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./popup.css" />
<!-- <link rel="stylesheet" href="./styles/popup.css" /> -->
<link rel="stylesheet" href="popup.css" />
</head>
<body>
<a
href="https://github.com/misa198/octotree-icon-theme"
href="https://github.com/misa198/octotree-theme"
rel="noreferrer"
target="__blank"
>
<header class="header">
<img class="header__icon" src="./icons/icon64.png" alt="" />
<h3 class="header__title">Octotree Icon Theme</h3>
<h3 class="header__title">Octotree Theme</h3>
</header>
</a>
<main class="main">
<div class="session">
<h3 class="session__label">Code Theme</h3>
<select class="select" id="select-code-color-theme">
<option value="default">Default</option>
</select>
</div>
<div class="session">
<h3 class="session__label">Github</h3>
<label class="form-switch">
<input id="misa198Github" type="checkbox" />
<i></i>
</label>
</div>
<div class="session">
<div class="session session--octotree">
<h3 class="session_label">Octotree</h3>
<label class="form-switch">
<input id="misa198Octotree" type="checkbox" />
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/background.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { set, get } from './storage';
import { KEYS } from './keys';
import { set, get } from './utils/storage';
import { KEYS } from './constants/keys';
const urlRegex = new RegExp(
/^https:\/\/github.com\/[(a-z)(A-Z)(0-9)_-]+\/[(a-z)(A-Z)(0-9)_-]+(\/?)((\/.+)?)(\?(.+))?$/
/^https:\/\/(gist.)?github.com\/[(a-z)(A-Z)(0-9)_-]+\/[(a-z)(A-Z)(0-9)_-]+(\/?)((\/.+)?)(\?(.+))?$/
);

get([KEYS.MISA198_GITHUB, KEYS.MISA198_OCTOTREE], (result) => {
Expand Down
30 changes: 30 additions & 0 deletions src/scripts/constants/colorThemes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export const colorThemeDeaultClass = 'misa198-github-code-color-theme';
export const colorThemes = [
'ambiance',
'ayu-mirage',
'chaos',
'clouds-midnight',
'cobalt',
'dracula',
'github-dark',
'idle-fingers',
'kr-theme',
'merbivore-soft',
'merbivore',
'mono-industrial-clear',
'mono-industrial',
'monokai-spacegray-eighties',
'monokai',
'obsidian',
'one-dark',
'pastel-on-dark',
'railscasts',
'solarized-dark',
'terminal',
'tomorrow-night-blue',
'tomorrow-night-bright',
'tomorrow-night-eighties',
'tomorrow-night',
'twilight',
'vibrant-ink',
];
27 changes: 27 additions & 0 deletions src/scripts/constants/colorThemesScss.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import '../../styles/themes/code/ambiance.scss';
import '../../styles/themes/code/ayu-mirage.scss';
import '../../styles/themes/code/chaos.scss';
import '../../styles/themes/code/clouds-midnight.scss';
import '../../styles/themes/code/cobalt.scss';
import '../../styles/themes/code/dracula.scss';
import '../../styles/themes/code/github-dark.scss';
import '../../styles/themes/code/idle-fingers.scss';
import '../../styles/themes/code/kr-theme.scss';
import '../../styles/themes/code/merbivore-soft.scss';
import '../../styles/themes/code/merbivore.scss';
import '../../styles/themes/code/mono-industrial-clear.scss';
import '../../styles/themes/code/mono-industrial.scss';
import '../../styles/themes/code/monokai-spacegray-eighties.scss';
import '../../styles/themes/code/monokai.scss';
import '../../styles/themes/code/obsidian.scss';
import '../../styles/themes/code/one-dark.scss';
import '../../styles/themes/code/pastel-on-dark.scss';
import '../../styles/themes/code/railscasts.scss';
import '../../styles/themes/code/solarized-dark.scss';
import '../../styles/themes/code/terminal.scss';
import '../../styles/themes/code/tomorrow-night-blue.scss';
import '../../styles/themes/code/tomorrow-night-bright.scss';
import '../../styles/themes/code/tomorrow-night-eighties.scss';
import '../../styles/themes/code/tomorrow-night.scss';
import '../../styles/themes/code/twilight.scss';
import '../../styles/themes/code/vibrant-ink.scss';
1 change: 1 addition & 0 deletions src/scripts/keys.ts → src/scripts/constants/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const KEYS = {
MISA198_OCTOTREE: 'misa198Octotree',
MISA198_GITHUB: 'misa198Github',
MISA198_RELOAD: 'misa198Reload',
MISA198_CODE_COLOR_THEME: 'misa198CodeColorTheme',
};
Loading

0 comments on commit d814e0c

Please sign in to comment.