├── .editorconfig ├── .gitignore ├── .gitmodules ├── COPYING ├── Makefile ├── README.md ├── node_modules ├── .bin │ └── rollup └── rollup │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── bin │ └── rollup │ ├── dist │ ├── rollup.browser.js │ ├── rollup.es.js │ └── rollup.js │ └── package.json ├── package-lock.json ├── res └── icon.svg ├── screenshots ├── contrast_test.png └── screenshot.png ├── src ├── .eslintrc.js ├── bg.ts ├── css │ ├── fixContrast.css │ ├── stdAll.css │ ├── stdFgOnly.css │ └── stdInputs.css ├── fixAll.ts ├── fixInputs.ts ├── frameListener.ts ├── icons │ └── icon-vec.svg ├── lib │ ├── checks.ts │ ├── color.ts │ └── contrast.ts ├── manifest.json ├── opt │ ├── options.css │ ├── options.html │ └── options.js ├── popup │ └── toggles.html └── popup_toggles.ts ├── tcfdt.sublime-project ├── test ├── cr.html ├── filteredDefaults.css ├── frame-src.html ├── mutation-perf.html ├── root_bg_img.html ├── test-frames.html ├── test-inputs-perms.html ├── test-inputs.html ├── test-svg.html ├── test-usc.html ├── test.css ├── test.svg └── transparent_bg.png ├── tsconfig.json ├── tsfmt.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | 3 | indent_style = space 4 | indent_size = 2 5 | tab_width = 2 6 | 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.xpi 2 | web-ext-artifacts/ 3 | build/ 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/types/web-ext-types"] 2 | path = src/types/web-ext-types 3 | url = https://github.com/kelseasy/web-ext-types.git 4 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright © 2016 Dmitri Kourennyi 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ROLLUP = node node_modules/rollup/bin/rollup 2 | 3 | CSS_FILES = js/fixContrast.css js/stdAll.css 4 | 5 | .PHONY: build/transpiled build/css 6 | 7 | all: build/ext/bg.js build/ext/fixInputs.js build/ext/fixAll.js \ 8 | build/ext/popup/toggles.js build/ext/frameListener.js build/ext/css \ 9 | build/ext/others 10 | 11 | build/transpiled: 12 | tsc -p . 13 | 14 | build/ext/bg.js: build/transpiled 15 | $(ROLLUP) build/transpiled/bg.js --output.format iife --output.file $@ 16 | 17 | build/ext/frameListener.js: build/transpiled 18 | $(ROLLUP) build/transpiled/frameListener.js --output.format iife --output.file $@ 19 | 20 | build/ext/fixInputs.js: build/transpiled 21 | $(ROLLUP) build/transpiled/fixInputs.js --output.format iife --output.file $@ 22 | 23 | build/ext/fixAll.js: build/transpiled 24 | $(ROLLUP) build/transpiled/fixAll.js --output.format iife --output.file $@ 25 | 26 | build/ext/css: src/css/*.css 27 | cp -r $? build/ext/ 28 | 29 | build/ext/others: src/manifest.json src/opt src/popup src/icons 30 | cp -r $? build/ext/ 31 | 32 | build/ext/popup/toggles.js: build/transpiled build/ext/others 33 | $(ROLLUP) build/transpiled/popup_toggles.js --output.format iife --output.file $@ 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Text Contrast for Dark Themes 2 | 3 | Firefox extension that fixes low contrast text when using a dark desktop theme. 4 | 5 | Avaible on AMO here: https://addons.mozilla.org/firefox/addon/text-contrast-for-dark-themes/ 6 | 7 | For users who don't want *any* native theming in web content, Firefox has a 8 | built-in solution. In `about:config`, verify that 9 | `widget.content.allow-gtk-dark-theme` is `false`. If you use a theme that does 10 | not have a light variant (e.g, Arc Dark; the light version, Arc, is a separate 11 | theme), then create a new string entry in `about:config` called 12 | `widget.content.gtk-theme-override` and set it to a light theme, e.g. `Arc` or 13 | `Adwaita:light`. 14 | 15 | Otherwise, for users who wish to retain dark theming of un-styled input elements 16 | or entire pages, this extension tries to fix broken author css to ensure text 17 | remains read-able. Note that per the above paragraph, such users will likely 18 | want to set `widget.content.allow-gtk-dark-theme` to `true`. 19 | 20 | ## Permission Requirements Explanations ## 21 | 22 | ### ### 23 | The extension inserts CSS and JavaScript into page content in order to fix 24 | colors, and requires URL permissions for all sites in order to do so. 25 | 26 | ### storage ### 27 | Extension settings use local storage. 28 | 29 | ### tabs ### 30 | Extension requires access to tab data to get active URL. In order for frames to 31 | see top-level tab URL, permissions for all tabs is needed, not just active tab. 32 | 33 | ### webNavigation ### 34 | Extension is triggered on web navigation events. 35 | 36 | ## Input Elements 37 | 38 | The primary purpose of this extension is to fix input elements, which are drawn 39 | with native widgets in the user's dark style. Many website authors assume that 40 | such elements are a dark-on-light style by default, and will only set one color 41 | in their styles. This results in poor contrast when drawn with the dark native 42 | widgets. 43 | 44 | This extension checks if only one of the colors has been defined (foreground 45 | color, or background color/image), and defines the unset property as needed. 46 | Elements with both colors defined or both colors undefined remain unchanged. 47 | Elements which already have good contrast (e.g. author is running their own dark 48 | styling) are also unchanged. 49 | 50 | In comparison to userContent.css/userChrome.css or similar fixes, this extension tries to 51 | minimize changes that fix the contrast issue. Thus native styles are retained if 52 | possible. 53 | 54 | ## Use with "Use System Colors" or custom colors 55 | 56 | Some users with a dark desktop theme may use the "Use System Colors" preference 57 | to set the page default foreground/background to be light-on-dark. Alternately, 58 | users may manually set a light-on-dark style with their own colors. Similar to 59 | the situation with input elements, this can cause problems with author CSS. 60 | 61 | This extension will detect the inverted default style and check for good 62 | contrast on the page itself. The check is performed recursively starting at the 63 | document root. Since colors are inherited by element children, the check bails 64 | early once it has found a explicitly styled element (whether due to author 65 | correctly setting both FG and BG, or extension making a fix). This keeps the 66 | performance impact of the page scan negligible. 67 | 68 | ## Dynamic Elements 69 | 70 | The extension performs required contrast checks (as above) for newly added or 71 | re-styled elements. Elements that have already been checked are not 72 | inspected, resulting in no slowdown with JavaScript heavy sites. 73 | 74 | ## IFrames and SVG images 75 | 76 | The sub-documents of IFrames and SVG images included via `` are traversed 77 | by the extension. The extension will try to correctly set the style of the inner 78 | sub-document based on the styling of the parent. 79 | 80 | For users with light-on-dark default colors, any SVG images included inline 81 | within a document are also checked by the extension. 82 | 83 | Note that SVG data included in an `` tag cannot be accessed via JavaScript, 84 | and this extension is unable to fix such cases. 85 | 86 | ## UI 87 | 88 | The extension provides a toolbar button that allows users to either: 89 | - Toggle the effects of the extension 90 | - For users with light-on-dark default colors, force a custom stylesheet that 91 | emulates the black text / white background default. 92 | Both toggles apply to the current tab only, and are temporary. A page refresh 93 | undoes the effects. 94 | 95 | Lastly, the extension options can also be accessed via the toolbar button menu. 96 | 97 | ## Options 98 | 99 | The extension provides some options for users to fine tune the operation. 100 | 101 | ### Contrast Threshold 102 | 103 | The extension does not modify element colors if it determines that they already 104 | have good contrast. The definition of good contrast is determined by this 105 | threshold. The extension uses the WCAG 2.0 definition of contrast 106 | (see 1.4.3: https://www.w3.org/TR/WCAG20/#visual-audio-contrast). Higher numbers 107 | make it more likely for the extension to change colors. 108 | 109 | ### Delay 110 | 111 | The extension can conflict with other extensions that modify page CSS. To allow 112 | the extension to run after any other custom CSS changes, a delay can be 113 | configured before the extension does any checking. 114 | 115 | ### Override Lists 116 | 117 | Some websites do not look good with this extension active. Two override lists 118 | are provided to avoid unwanted effects. 119 | 120 | #### Disable List 121 | 122 | The extension is disabled for sites in this list. If the site works well without 123 | the extension, but looks worse with it active, add the site to this list. 124 | 125 | #### Force Standard List 126 | 127 | The extension tries to force a default black text / white background style for 128 | any sites in this list. If sites don't looks good or end up too busy with the 129 | extension, this list can be used to revert to the stock browser style. 130 | 131 | ## Known Issues 132 | 133 | The following list of issues are known and cannot be fixed at this time. 134 | 135 | ## AMO (addons.mozilla.org) 136 | 137 | The extension does not function on addons.mozilla.org. This is a restriction 138 | enforced by Mozilla for any extension, presumably as a security feature. 139 | Unfortunately, the stylesheets on those pages are poorly written, and will 140 | result in black-on dark styling for many of the input elements. 141 | 142 | ## Internal Pages 143 | 144 | The extension cannot operate on internal pages, such as `about:` links, 145 | option pages for other extensions, and so on. As above, this is a built-in 146 | restriction of all web extensions. 147 | 148 | ## Intentionally Hidden Text 149 | 150 | Some site authors deliberately set a foreground or a background color with the 151 | intention of hiding text. When this extension encounters such an element, it has 152 | no way of knowing the poor contrast is intentional, and thus will fix the 153 | element. The extension should either be disabled for that specific site, or 154 | custom CSS fixing the offending element should be applied via userContent.css or 155 | similar. 156 | 157 | ## SVG 158 | 159 | SVG elements included as `` cannot be traversed via JavaScript. If the SVG 160 | uses the 'currentColor' string for colors, these are pulled from the browser 161 | default colors, independent of the styling of the enclosing page. With no access 162 | to the SVG DOM, this extension cannot fix such cases. This is currently a major 163 | issue with with Wikipedia formulas, which will render in the user's selected 164 | foreground color, on a white background as set by the Wikipedia CSS. The only 165 | fix is to use custom CSS to force colors background on the parent page to ensure 166 | correct contrast (in the case of Wikipedia, force the background to be dark). 167 | 168 | ## Element positioning 169 | 170 | Some sites explicitly place elements outside of the normal layout flow. This 171 | extension relies on the fact that children inherit parent styles to keep fixes 172 | small and performant. The extension is unable to know that an element may have 173 | been moved above another element resulting in poor contrast. Forcing standard 174 | colors may alleviate the issue on such sites. 175 | 176 | ## Cross-origin iFrames 177 | 178 | When trying to fix all elements, and iframes are involved, the extensions must 179 | decide how to style an iframe based on what the parent does (if parent styles 180 | have been fixed, then iframe should be forced into standard colors, otherwise 181 | processed normally). This communication channel between the iframe and the 182 | parent is restricted when the frames are cross-origin, which blocks access to 183 | properties that the parent needs to determine if a fix is needed. This will 184 | result in the extensions failing to work in iframes on certain sites, which may 185 | require adding the site to one of the override lists. 186 | -------------------------------------------------------------------------------- /node_modules/.bin/rollup: -------------------------------------------------------------------------------- 1 | ../rollup/bin/rollup -------------------------------------------------------------------------------- /node_modules/rollup/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/rollup/README.md: -------------------------------------------------------------------------------- 1 | # Rollup 2 | 3 |

4 | 5 | build status 7 | 8 | 9 | npm version 11 | 12 | 13 | license 15 | 16 | 17 | dependency status 19 | 20 | 21 | Coverage via Codecov 22 | 23 | 24 | Join the chat at https://gitter.im/rollup/rollup 26 | 27 |

28 | 29 | ## Overview 30 | 31 | Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the new standardized format for code modules included in the ES6 revision of JavaScript, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES6 modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. This will eventually be possible natively, but Rollup lets you do it today. 32 | 33 | ## Quick Start Guide 34 | 35 | Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file, or else through its [JavaScript API](https://rollupjs.org/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](http://rollupjs.org/). 36 | 37 | ### Commands 38 | 39 | These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js. 40 | 41 | For browsers: 42 | 43 | ```bash 44 | # compile to a 9 | 10 | 11 | 12 |

Text Contrast for Dark Themes Options

13 |
14 |
15 |

Contrast Threshold

16 |
17 |

18 | Minimum contrast required for recoloring elements. Extension only 19 | re-colors elements if resulting contrast is higher than this 20 | threshold. Meaningless if not using "Use system colors" option. 21 |

22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
TextWCAG AAWCAG AAA
Normal4.5 (default)7.0
Large3.04.5
31 |
32 | 33 | 34 | 35 | 36 |
37 |
38 |

Delay

39 |
40 |

41 | Optional delay for operation of extension. This may be needed if another 42 | style-changing extension (e.g. stylish, dotjs, dark mode) randomly 43 | interferes. The extension will delay itself by the specified amount to 44 | ensure that other style changes occur before processing. Usually a few 45 | 10s of ms is sufficient. Set to 0 to disable delay. 46 |

47 |
48 | ms 49 | 50 |
51 |
52 |
53 |
54 |

Disable extension

55 |
56 |

For sites that break with extension enabled. Prevents or allows extension from doing anything at all

57 |

58 | Ideally, this extension shouldn't break sites, so if you find yourself 59 | adding a site to the 'Disable extension' section to deal with an issue, 60 | consider filing a bug at 61 | 62 | https://github.com/DmitriK/darkContrast/issues 63 | 64 |

65 |

66 | Type a match string into the text boxes, one per line. Press 'Save' when 67 | done. Extension will do simple matching against the site URL. 68 |

69 |
70 | 71 | 75 | 76 |
77 | 78 | 79 |
80 |
81 |
82 |

Force standard colors

83 |
84 |

For sites that work but look ugly with extension enabled. Extension forces black text on white background as default for all elements.

85 |

86 | Type a match string into the text boxes, one per line. Press 'Save' when 87 | done. Extension will do simple matching against the site URL. 88 |

89 |
90 | 91 |
92 | 93 | 94 |
95 |
96 | 97 |
98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/opt/options.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Dmitri Kourennyi */ 2 | /* See the file COPYING for copying permission. */ 3 | 'use strict'; 4 | 5 | const {storage} = browser; 6 | 7 | function main() { 8 | storage.local.get({ 9 | 'tcfdt-cr': 4.5, 10 | 'tcfdt-list-disabled': [], 11 | 'tcfdt-list-standard': [], 12 | 'tcfdt-wlist': false, 13 | 'tcfdt-dl': 0, 14 | }) 15 | .then((opts) => { 16 | // Load everything from storage 17 | // Lists... 18 | document.getElementById('blacklist').value = 19 | opts['tcfdt-list-disabled'].join('\n'); 20 | document.getElementById('standardlist').value = 21 | opts['tcfdt-list-standard'].join('\n'); 22 | 23 | // Contrast ratio... 24 | let cr = opts['tcfdt-cr']; 25 | 26 | if (isNaN(cr) || cr < 1 || cr > 21) { 27 | cr = 4.5; 28 | } 29 | document.getElementById('cr').value = cr; 30 | 31 | // Delay... 32 | document.getElementById('delay').value = opts['tcfdt-dl']; 33 | 34 | // List mode... 35 | if (opts['tcfdt-wlist']) { 36 | document.getElementById('wlist').checked = true; 37 | document.getElementById('list-mode-title').textContent = 'Enable'; 38 | } else { 39 | document.getElementById('wlist').checked = false; 40 | document.getElementById('list-mode-title').textContent = 'Disable'; 41 | } 42 | }) 43 | .then(() => { 44 | // Set event listeners 45 | // Lists... 46 | document.getElementById('save-dis').addEventListener('click', () => { 47 | const lines = 48 | document.getElementById('blacklist').value 49 | .split('\n') 50 | .filter(s => s.trim() !== ""); 51 | 52 | if (lines.length === 0) { 53 | storage.local.remove('tcfdt-list-disabled'); 54 | } else { 55 | storage.local.set({'tcfdt-list-disabled': lines}); 56 | } 57 | }); 58 | 59 | document.getElementById('save-std').addEventListener('click', () => { 60 | const lines = 61 | document.getElementById('standardlist').value 62 | .split('\n') 63 | .filter(s => s.trim() !== ""); 64 | 65 | if (lines.length === 0) { 66 | storage.local.remove('tcfdt-list-standard'); 67 | } else { 68 | storage.local.set({'tcfdt-list-standard': lines}); 69 | } 70 | }); 71 | 72 | document.getElementById('revert-dis').addEventListener('click', () => { 73 | document.getElementById('blacklist').value = ''; 74 | storage.local.get({'tcfdt-list-disabled': []}).then((opts) => { 75 | document.getElementById('blacklist').value = 76 | opts['tcfdt-list-disabled'].join('\n'); 77 | }); 78 | }); 79 | 80 | document.getElementById('revert-std').addEventListener('click', () => { 81 | document.getElementById('standardlist').value = ''; 82 | storage.local.get({'tcfdt-list-standard': []}).then((opts) => { 83 | document.getElementById('standardlist').value = 84 | opts['tcfdt-list-standard'].join('\n'); 85 | }); 86 | }); 87 | 88 | // Contrast ratio... 89 | document.getElementById('setCR').addEventListener('click', () => { 90 | const newCR = parseFloat(document.getElementById('cr').value); 91 | 92 | storage.local.set({'tcfdt-cr': newCR}); 93 | }); 94 | 95 | // Delay... 96 | document.getElementById('setDelay').addEventListener('click', () => { 97 | let newDelay = document.getElementById('delay').value | 0; 98 | 99 | if (newDelay <= 0) { 100 | newDelay = 0; 101 | } 102 | 103 | browser.storage.local.set({'tcfdt-dl': newDelay}); 104 | }); 105 | 106 | // List mode... 107 | document.getElementById('wlist').addEventListener('change', (e) => { 108 | const newMode = e.currentTarget.checked; 109 | 110 | if (newMode) { 111 | document.getElementById('list-mode-title').textContent = 'Enable'; 112 | } else { 113 | document.getElementById('list-mode-title').textContent = 'Disable'; 114 | } 115 | 116 | browser.storage.local.set({'tcfdt-wlist': newMode}); 117 | }); 118 | }) 119 | .then(() => { 120 | // Enable inputs 121 | // Lists... 122 | document.getElementById('blacklist').disabled = false; 123 | document.getElementById('standardlist').disabled = false; 124 | document.getElementById('save-dis').disabled = false; 125 | document.getElementById('save-std').disabled = false; 126 | document.getElementById('revert-dis').disabled = false; 127 | document.getElementById('revert-std').disabled = false; 128 | 129 | // Contrast ratio... 130 | document.getElementById('cr').disabled = false; 131 | document.getElementById('setCR').disabled = false; 132 | 133 | // Delay... 134 | document.getElementById('delay').disabled = false; 135 | document.getElementById('setDelay').disabled = false; 136 | 137 | // List mode... 138 | document.getElementById('wlist').disabled = false; 139 | }); 140 | } 141 | 142 | window.addEventListener('load', main); 143 | -------------------------------------------------------------------------------- /src/popup/toggles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 65 | 66 | 67 |
68 |
69 | Toggles (refresh to clear) 70 | 71 | 72 |
73 | 78 |
79 |
80 |

Add to list:

81 | 84 | 87 | 90 |
91 |
92 |

Add to standard colors list:

93 | 96 | 99 | 102 |
103 | 104 | 105 | -------------------------------------------------------------------------------- /src/popup_toggles.ts: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Dmitri Kourennyi */ 2 | /* See the file COPYING for copying permission. */ 3 | 4 | const { runtime, storage, tabs } = browser; 5 | 6 | let toggle_on = () => { 7 | browser.tabs.query({ currentWindow: true, active: true }).then((tabs) => { 8 | runtime.sendMessage('', { request: 'on', allFrames: true, tabId: tabs[0].id }); 9 | }); 10 | }; 11 | 12 | let toggle_off = () => { 13 | browser.tabs.query({ currentWindow: true, active: true }).then((tabs) => { 14 | runtime.sendMessage('', { request: 'off', allFrames: true, tabId: tabs[0].id }); 15 | }); 16 | }; 17 | 18 | window.addEventListener('load', () => { 19 | (document.getElementById('tog_std') as HTMLButtonElement).addEventListener('click', () => { 20 | tabs.query({ currentWindow: true, active: true }).then((tabs) => { 21 | runtime.sendMessage('', { request: 'std', allFrames: true, tabId: tabs[0].id }); 22 | }); 23 | }); 24 | 25 | (document.getElementById('open_opts') as HTMLButtonElement).addEventListener('click', () => { 26 | runtime.openOptionsPage(); 27 | }); 28 | 29 | storage.local.get('tcfdt-wlist').then((opts) => { 30 | let wList: boolean = opts['tcfdt-wlist'] as boolean; 31 | 32 | let el = document.getElementById('listKind') as HTMLSpanElement; 33 | 34 | el.textContent = wList ? 'white' : 'black'; 35 | 36 | el = document.getElementById('togModeTxt') as HTMLSpanElement; 37 | el.textContent = wList ? 'on' : 'off'; 38 | 39 | // Change what toggle button callback does 40 | (document.getElementById('tog_main') as HTMLButtonElement).addEventListener('click', wList ? toggle_on : toggle_off); 41 | }); 42 | 43 | tabs.query({ currentWindow: true, active: true }).then((tabs) => { 44 | let url: string = tabs[0].url!; 45 | 46 | let locProbe = document.createElement('a'); 47 | locProbe.href = url; 48 | 49 | let host = locProbe.hostname; 50 | let path = `${host}${locProbe.pathname}`; 51 | 52 | document.querySelectorAll('.hostEx').forEach((el) => { 53 | el.textContent = host; 54 | }); 55 | document.querySelectorAll('.pathEx').forEach((el) => { 56 | el.textContent = path; 57 | }); 58 | document.querySelectorAll('.fullEx').forEach((el) => { 59 | el.textContent = url; 60 | }); 61 | 62 | for (let id of [ 63 | 'add_hst_ovr', 'add_pth_ovr', 'add_url_ovr', 64 | 'add_hst_std', 'add_pth_std', 'add_url_std', 65 | ]) { 66 | let btn = (document.getElementById(id) as HTMLButtonElement); 67 | btn.addEventListener('click', (e: Event) => { 68 | let idStr: string = (e.currentTarget as HTMLButtonElement).id; 69 | let [, part, list] = idStr.split('_'); 70 | 71 | let entry: string; 72 | 73 | if (part === 'hst') { 74 | entry = host; 75 | } else if (part === 'pth') { 76 | entry = path; 77 | } else if (part === 'url') { 78 | entry = url; 79 | } else { 80 | return; 81 | } 82 | 83 | let tObj: 'tcfdt-list-standard' | 'tcfdt-list-disabled'; 84 | 85 | if (list === 'std') { 86 | tObj = 'tcfdt-list-standard'; 87 | } else if (list === 'ovr') { 88 | tObj = 'tcfdt-list-disabled'; 89 | } else { 90 | return; 91 | } 92 | 93 | storage.local.get(tObj).then((opts) => { 94 | let list: string[] = []; 95 | if (tObj in opts) { 96 | list = opts[tObj] as string[]; 97 | } 98 | if (list.indexOf(entry) === -1) { 99 | list.push(entry); 100 | } 101 | let newStore: { [key: string]: string[] } = {}; 102 | newStore[tObj] = list; 103 | storage.local.set(newStore); 104 | }, (err) => { 105 | console.log("Failed to save entry ", entry, " into list ", list, " : ", err); 106 | }); 107 | }); 108 | } 109 | }); 110 | }); 111 | -------------------------------------------------------------------------------- /tcfdt.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": ".", 6 | "folder_exclude_patterns": ["build", "node_modules"] 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /test/cr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | DarkContrast Test Page - Contrast Ratio 10 | 15 | 16 | 17 | Set default BG to black to test
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
1.0 1.0 1.0 1.0
2.0 2.0 2.0 2.0
3.0 3.0 3.0
4.0 4.0 4.0
5.0 5.0 5.0
6.0 6.0
7.0 7.0
8.0 8.0
9.0 9.0
10.0 10.0
11.0 11.0
12.0 12.0
13.0 13.0
14.0 14.0
15.0 15.0
16.0
17.0
18.0
19.0
20.0
21.0
41 | 42 | -------------------------------------------------------------------------------- /test/filteredDefaults.css: -------------------------------------------------------------------------------- 1 | input { 2 | background-color: -moz-Field; 3 | color: -moz-FieldText; 4 | } 5 | 6 | textarea { 7 | background-color: -moz-Field; 8 | color: -moz-FieldText; 9 | } 10 | 11 | select { 12 | background-color: -moz-Combobox; 13 | color: -moz-ComboboxText; 14 | } 15 | 16 | select[size], 17 | select[multiple], 18 | select[size][multiple] { 19 | background-color: -moz-Field; 20 | color: -moz-FieldText; 21 | } 22 | 23 | select[size="0"], 24 | select[size="1"] { 25 | background-color: -moz-Combobox; 26 | color: -moz-ComboboxText; 27 | } 28 | 29 | option:checked { 30 | background-color: -moz-html-cellhighlight !important; 31 | color: -moz-html-cellhighlighttext !important; 32 | } 33 | 34 | select:focus > option:checked, 35 | select:focus > optgroup > option:checked { 36 | background-color: Highlight ! important; 37 | color: HighlightText ! important; 38 | } 39 | 40 | input:disabled, 41 | textarea:disabled, 42 | option:disabled, 43 | optgroup:disabled, 44 | select:disabled:disabled /* Need the pseudo-class twice to have the specificity 45 | be at least the same as select[size][multiple] above */ 46 | { 47 | color: GrayText; 48 | background-color: ThreeDLightShadow; 49 | 50 | } 51 | 52 | option:disabled, 53 | optgroup:disabled { 54 | background-color: transparent; 55 | } 56 | 57 | /* image buttons */ 58 | input[type="image"] { 59 | background-color: transparent; 60 | } 61 | 62 | /* file selector */ 63 | input[type="file"] { 64 | color: inherit; 65 | background-color: transparent; 66 | } 67 | 68 | input[type="file"] > xul|label { 69 | color: inherit; 70 | } 71 | 72 | /* common features of radio buttons and check boxes */ 73 | 74 | input[type="radio"], 75 | input[type="checkbox"] { 76 | background-color: unset; 77 | color: unset; 78 | } 79 | 80 | button, 81 | input[type="color"], 82 | input[type="reset"], 83 | input[type="button"], 84 | input[type="submit"] { 85 | background-color: ButtonFace; 86 | } 87 | 88 | button, 89 | input[type="reset"], 90 | input[type="button"], 91 | input[type="submit"] { 92 | color: ButtonText; 93 | } 94 | 95 | button:hover, 96 | input[type="color"]:hover, 97 | input[type="reset"]:hover, 98 | input[type="button"]:hover, 99 | input[type="submit"]:hover { 100 | background-color: -moz-buttonhoverface; 101 | } 102 | 103 | button:hover, 104 | input[type="reset"]:hover, 105 | input[type="button"]:hover, 106 | input[type="submit"]:hover { 107 | color: -moz-buttonhovertext; 108 | } 109 | 110 | button:active:hover, 111 | input[type="color"]:active:hover, 112 | input[type="reset"]:active:hover, 113 | input[type="button"]:active:hover, 114 | input[type="submit"]:active:hover { 115 | background-color: ButtonFace; 116 | } 117 | 118 | button:active:hover, 119 | input[type="reset"]:active:hover, 120 | input[type="button"]:active:hover, 121 | input[type="submit"]:active:hover { 122 | color: ButtonText; 123 | } 124 | 125 | button:disabled:active, button:disabled, 126 | input[type="reset"]:disabled:active, 127 | input[type="reset"]:disabled, 128 | input[type="button"]:disabled:active, 129 | input[type="button"]:disabled, 130 | select:disabled > button, 131 | select:disabled > button, 132 | input[type="submit"]:disabled:active, 133 | input[type="submit"]:disabled { 134 | color: GrayText; 135 | } 136 | 137 | output:-moz-ui-invalid { 138 | color: red; 139 | } 140 | 141 | progress { 142 | background-color: #e6e6e6; 143 | } 144 | 145 | ::-moz-progress-bar { 146 | background-color: #0064b4; /* blue */ 147 | } 148 | 149 | input[type=range]::-moz-range-track { 150 | background-color: #999; 151 | } 152 | 153 | input[type=range]::-moz-range-thumb { 154 | background-color: #F0F0F0; 155 | } 156 | 157 | input[type="number"] > div > div > div:hover { 158 | /* give some indication of hover state for the up/down buttons */ 159 | background-color: lightblue; 160 | } 161 | -------------------------------------------------------------------------------- /test/frame-src.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
Nothing
7 |
FG only
8 |
BG only
9 |
BG img
10 |
Both
11 | 12 | 13 | -------------------------------------------------------------------------------- /test/mutation-perf.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | 22 | 23 | 24 |
Modified other
25 |
Added other
26 | 27 | -------------------------------------------------------------------------------- /test/root_bg_img.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
Should see gray swirls on dark blue BG.
7 |
BG only
8 |
BG img
9 |
Both
10 | 11 | 12 | -------------------------------------------------------------------------------- /test/test-frames.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | Test iFrame fixes 11 | 12 | 13 | 23 | 34 | 35 | 36 | 37 |

Direct iframe styling

38 |
39 |
Nothing:
40 |
FG only:
41 |
BG only:
42 |
BG image:
43 |
Both:
44 |
Dynamic, plain
45 |
46 |

Container element styling

47 |
48 |
FG only:
49 |
BG only:
50 |
BG image:
51 |
Both:
52 |
Dynamic, with bg
53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /test/test-inputs-perms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | DarkContrast Test Page 9 | 20 | 64 | 65 | 66 | 67 |

DarkContrast Check Page for weird input styles

68 |

69 | Explicit foreground color 70 | Explicit background color 71 |

72 |
73 |
74 |

Nothing defined

75 |
76 | 77 | 78 | 81 | 84 | 88 | 91 | 94 | 97 | 98 | 99 | 102 | 105 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
121 |
122 |
123 |

FG only

124 |
125 | 126 | 127 | 130 | 133 | 137 | 140 | 143 | 146 | 147 | 148 | 151 | 154 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 |
170 |
171 |
172 |

BG only

173 |
174 | 175 | 176 | 179 | 182 | 186 | 189 | 192 | 195 | 196 | 197 | 200 | 203 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 |
219 |
220 |
221 |

FG and BG

222 |
223 | 224 | 225 | 228 | 231 | 235 | 238 | 241 | 244 | 245 | 246 | 249 | 252 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 |
268 |
269 |
270 |

BG image only

271 |
272 | 273 | 274 | 277 | 280 | 284 | 287 | 290 | 293 | 294 | 295 | 298 | 301 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 |
317 |
318 |
319 |

Transparent BG image only

320 |
321 | 322 | 323 | 326 | 329 | 333 | 336 | 339 | 342 | 343 | 344 | 347 | 350 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 |
366 |
367 |
368 |

FG and BG image

369 |
370 | 371 | 372 | 375 | 378 | 382 | 385 | 388 | 391 | 392 | 393 | 396 | 399 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 |
415 |
416 |
417 |

FG and Transparent BG image only

418 |
419 | 420 | 421 | 424 | 427 | 431 | 434 | 437 | 440 | 441 | 442 | 445 | 448 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 |
464 |
465 |
466 |

Dynamic class change

467 |
468 | 469 | 470 | 473 | 476 | 480 | 483 | 486 | 489 | 490 | 491 | 494 | 497 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 |
513 |
514 |
515 |

Explicit Foreground that Matches

516 |
517 | 518 | 519 | 522 | 525 | 529 | 532 | 535 | 538 | 539 | 540 | 543 | 546 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 |
562 |
563 |
564 |

Explicit Background that Matches

565 |
566 | 567 | 568 | 571 | 574 | 578 | 581 | 584 | 587 | 588 | 589 | 592 | 595 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 |
611 |
612 |
613 |

Explicit Both that Match

614 |
615 | 616 | 617 | 620 | 623 | 627 | 630 | 633 | 636 | 637 | 638 | 641 | 644 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 |
660 |
661 |
662 |

Matchy FG, contrasty BG

663 |
664 | 665 | 666 | 669 | 672 | 676 | 679 | 682 | 685 | 686 | 687 | 690 | 693 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 |
709 |
710 |
711 |

Matchy BG, contrasty FG

712 |
713 | 714 | 715 | 718 | 721 | 725 | 728 | 731 | 734 | 735 | 736 | 739 | 742 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 |
758 |
759 |
760 |

Hidden Foreground

761 |

762 | Will be (incorrectly) visible with extension enabled. Should be hidden 763 | if standard colors are forced (currently fails due to Firefox styling 764 | strangeness). 765 |

766 |
767 | 768 | 769 | 772 | 775 | 779 | 782 | 785 | 788 | 789 | 790 | 793 | 796 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 |
812 |
813 |
814 |

Hidden Background

815 |

816 | Will be (incorrectly) visible with extension enabled. Should be hidden 817 | if standard colors are forced (currently fails due to Firefox styling 818 | strangeness). 819 |

820 |
821 | 822 | 823 | 826 | 829 | 833 | 836 | 839 | 842 | 843 | 844 | 847 | 850 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 |
866 |
867 |
868 | 869 | 870 | 871 | -------------------------------------------------------------------------------- /test/test-inputs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | DarkContrast Test Page 9 | 10 | 59 | 103 | 104 | 105 | 106 |

DarkContrast Check Page

107 |

Explicit foreground color

108 |

Explicit background color

109 |
110 |
111 |

Nothing defined

112 |
113 | 114 |
115 | 116 |
117 | 120 |
121 | 122 |
123 |
124 |
125 |

FG only

126 |
127 | 128 |
129 | 130 |
131 | 134 |
135 | 136 |
137 |
138 |
139 |

BG only

140 |
141 | 142 |
143 | 144 |
145 | 148 |
149 | 150 |
151 |
152 |
153 |

FG and BG

154 |
155 | 156 |
157 | 158 |
159 | 162 |
163 | 164 |
165 |
166 |
167 |

BG image only

168 |
169 | 170 |
171 | 172 |
173 | 176 |
177 | 178 |
179 |
180 |
181 |

Transparent BG image only

182 |
183 | 184 |
185 | 186 |
187 | 190 |
191 | 192 |
193 |
194 |
195 |

FG and BG image

196 |
197 | 198 |
199 | 200 |
201 | 204 |
205 | 206 |
207 |
208 |
209 |

FG and Transparent BG image only

210 |
211 | 212 |
213 | 214 |
215 | 218 |
219 | 220 |
221 |
222 |
223 |

Dynamic class change

224 |
225 | 226 |
227 | 228 |
229 | 232 |
233 | 234 |
235 |
236 |
237 |

Explicit Foreground that Matches

238 |
239 | 240 |
241 | 242 |
243 | 246 |
247 | 248 |
249 |
250 |
251 |

Explicit Background that Matches

252 |
253 | 254 |
255 | 256 |
257 | 260 |
261 | 262 |
263 |
264 |
265 |

Explicit Both that Match

266 |
267 | 268 |
269 | 270 |
271 | 274 |
275 | 276 |
277 |
278 |
279 |

Matchy FG, contrasty BG

280 |
281 | 282 |
283 | 284 |
285 | 288 |
289 | 290 |
291 |
292 |
293 |

Matchy BG, contrasty FG

294 |
295 | 296 |
297 | 298 |
299 | 302 |
303 | 304 |
305 |
306 |
307 |

Hidden Foreground

308 |

309 | Will be (incorrectly) visible with extension enabled. Should be hidden 310 | if standard colors are forced (currently fails due to Firefox styling 311 | strangeness). 312 |

313 |
314 | 315 |
316 | 317 |
318 | 321 |
322 | 323 |
324 |
325 |
326 |

Hidden Background

327 |

328 | Will be (incorrectly) visible with extension enabled. Should be hidden 329 | if standard colors are forced (currently fails due to Firefox styling 330 | strangeness). 331 |

332 |
333 | 334 |
335 | 336 |
337 | 340 |
341 | 342 |
343 |
344 |
345 | 346 | 347 | 348 | -------------------------------------------------------------------------------- /test/test-svg.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | Test SVG fixes 11 | 12 | 13 | 37 | 38 | 39 | 40 |

Direct Styling:

41 |
42 |
43 |

Embedded img

44 |
Nothing:
45 |
46 |
FG only:
47 |
BG only:
48 |
BG img:
49 |
Both:
50 |
51 |
52 |

Embedded object

53 |
Nothing:
54 |
FG only:
55 |
BG only:
56 |
BG img:
57 |
Both:
58 |
59 |
60 |

Embedded embed

61 |
Nothing:
62 |
FG only:
63 |
BG only:
64 |
BG img:
65 |
Both:
66 |
67 |
68 |

Embedded iframe

69 |
Nothing:
70 |
FG only:
71 |
BG only:
72 |
BG img:
73 |
Both:
74 |
75 |
76 |

Embedded css-bg

77 |
Nothing:
78 |
FG only:
79 |
BG only:
80 |
BG img:
81 |
Both:
82 |
83 |
84 |

Inline

85 |
Nothing:
86 | 87 | 88 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 |
112 |
FG only:
113 | 114 | 115 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 |
139 |
BG only:
140 | 141 | 142 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 |
BG img:
167 | 168 | 169 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 |
193 |
Both:
194 | 195 | 196 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 |
220 |
221 |
222 |

Container Styling:

223 |
224 |
225 |

Embedded img

226 |
Nothing:
227 |
228 |
FG only:
229 |
BG only:
230 |
BG img:
231 |
Both:
232 |
233 |
234 |

Embedded object

235 |
Nothing:
236 |
FG only:
237 |
BG only:
238 |
BG img:
239 |
Both:
240 |
241 |
242 |

Embedded embed

243 |
Nothing:
244 |
FG only:
245 |
BG only:
246 |
BG img:
247 |
Both:
248 |
249 |
250 |

Embedded iframe

251 |
Nothing:
252 |
FG only:
253 |
BG only:
254 |
BG img:
255 |
Both:
256 |
257 |
258 |

Embedded css-bg

259 |
Nothing:
260 |
FG only:
261 |
BG only:
262 |
BG img:
263 |
Both:
264 |
265 |
266 |

Inline

267 |
Nothing:
268 | 269 | 270 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 |
294 |
FG only:
295 | 296 | 297 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 |
321 |
BG only:
322 | 323 | 324 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 |
348 |
BG img:
349 | 350 | 351 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 |
375 |
Both:
376 | 377 | 378 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 |
402 |
403 |
404 | 405 | 406 | 407 | -------------------------------------------------------------------------------- /test/test-usc.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | Test Use System Colors fixes 11 | 12 | 31 | 52 | 53 | 54 | 55 |
56 | Nothing defined. 57 |
58 |
59 | Foreground only. 60 |
61 |
62 | Background only. 63 |
64 |
65 | Background image. 66 |
67 | 68 |
69 |
70 | 71 |
72 | Test transparent root element.
73 | 74 |
75 | 76 |
77 | Mutations 78 |
79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /test/test.css: -------------------------------------------------------------------------------- 1 | .fg { 2 | color: black; 3 | } 4 | .bg { 5 | background: white; 6 | } 7 | .bgimg { 8 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEWrze+83v+32CWOAAAAEElEQVR4AWNk+I8d/WfEigCAsxAJdjDJwwAAAABJRU5ErkJggg==); 9 | } 10 | -------------------------------------------------------------------------------- /test/test.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/transparent_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DmitriK/darkContrast/78c6020f208bd6ae4637cacd18ed15b70f87e6e3/test/transparent_bg.png -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./build/transpiled", 4 | "allowJs": false, 5 | "target": "ES2017", 6 | "module": "es2015", 7 | "strict": true, 8 | "sourceMap": false, 9 | "noUnusedLocals": true, 10 | "noUnusedParameters": true, 11 | "typeRoots": ["@types", "./src/types/web-ext-types"], 12 | "noEmitHelpers": true, 13 | }, 14 | "include": [ 15 | "./src/*.ts", 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /tsfmt.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabSize": 2, 3 | "indentSize": 2, 4 | "convertTabsToSpaces": true, 5 | "insertSpaceAfterCommaDelimiter": true, 6 | "insertSpaceAfterSemicolonInForStatements": true, 7 | "insertSpaceBeforeAndAfterBinaryOperators": true, 8 | "insertSpaceAfterKeywordsInControlFlowStatements": true, 9 | "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, 10 | "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, 11 | "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, 12 | "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, 13 | "insertSpaceBeforeFunctionParenthesis": false, 14 | "placeOpenBraceOnNewLineForFunctions": false, 15 | "placeOpenBraceOnNewLineForControlBlocks": false 16 | } 17 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:all", 3 | "rules": { 4 | "binary-expression-operand-order": false, 5 | "comment-format": [true, "check-space"], 6 | "interface-name": false, 7 | "max-classes-per-file": false, 8 | "member-ordering": [true, { 9 | "order": "fields-first", 10 | "alphabetize": false 11 | }], 12 | "no-magic-numbers": false, 13 | "no-parameter-properties": false, 14 | "object-literal-sort-keys": [ 15 | true, 16 | "match-declaration-order" 17 | ], 18 | "prefer-const": false, 19 | "quotemark": [true, "single"], 20 | "typedef": [true, 21 | "call-signature", 22 | "arrow-call-signature", 23 | "parameter", 24 | "arrow-parameter", 25 | "property-declaration", 26 | "member-variable-declaration" 27 | ] 28 | } 29 | } --------------------------------------------------------------------------------