aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview
diff options
context:
space:
mode:
authorLibravatar Mahadevan Sreenivasan <mahadevan_sv@yahoo.com>2020-04-14 14:56:16 +0530
committerLibravatar GitHub <noreply@github.com>2020-04-14 10:26:16 +0100
commit100016e38098ff389b2d6899dee76413da26f2ae (patch)
treebcb0f69ef87b4fb91905da2a58538d3e8cc828e5 /src/webview
parentNew Crowdin translations (#495) (diff)
downloadferdium-app-100016e38098ff389b2d6899dee76413da26f2ae.tar.gz
ferdium-app-100016e38098ff389b2d6899dee76413da26f2ae.tar.zst
ferdium-app-100016e38098ff389b2d6899dee76413da26f2ae.zip
Expose Dark Reader settings (#568)
* feat: Expose DarkReader settings to users - In the service model, expose an object darkReaderSetting which contains brightness, contrast and sepia values. - In EditServiceScreen, provide 3 form options for brightness, contrast and Sepia. Additionally onSubmit() form, capture the darkreader settings data onto formdata.darkReaderSettings to update in the service - In EditServiceForm, if darkModeEnabled is checked, show 3 sliders for controlling darkreader settings - Create a new Slider control and customize it according to the application's theme and dark theme. - In Webview Recipe, load the darkReader settings from service settings and pass it to the darkReader library. * feat: Darkreader settings - Lint fixes * feat: DarkReader settings - refactor code in editservicescreen.js Co-Authored-By: Sampath Kumar Krishnan <sampath3493@gmail.com> * feat: Darkreader settings - Fix a crash where service.darkReaderSettings is null while creating a new service - Remove isDarkModeEnabled prop to EditServiceForm as it is no longer required. * fix: Update EditServiceScreen - Set the default value of darkReader Brightness, Contrast and Sepia to undefined as per @vantezzen 's suggestion. - Updated the check provided by @mahadevans87 Co-authored-by: Sampath Kumar Krishnan <sampath3493@gmail.com> Co-authored-by: Sampath Kumar Krishnan <sampathBlam@users.noreply.github.com>
Diffstat (limited to 'src/webview')
-rw-r--r--src/webview/recipe.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/webview/recipe.js b/src/webview/recipe.js
index 7b762af17..8125ec064 100644
--- a/src/webview/recipe.js
+++ b/src/webview/recipe.js
@@ -157,6 +157,7 @@ class RecipeController {
157 debug('isDarkModeEnabled', this.settings.service.isDarkModeEnabled); 157 debug('isDarkModeEnabled', this.settings.service.isDarkModeEnabled);
158 debug('System spellcheckerLanguage', this.settings.app.spellcheckerLanguage); 158 debug('System spellcheckerLanguage', this.settings.app.spellcheckerLanguage);
159 debug('Service spellcheckerLanguage', this.settings.service.spellcheckerLanguage); 159 debug('Service spellcheckerLanguage', this.settings.service.spellcheckerLanguage);
160 debug('darkReaderSettigs', this.settings.service.darkReaderSettings);
160 161
161 if (this.userscript && this.userscript.internal_setSettings) { 162 if (this.userscript && this.userscript.internal_setSettings) {
162 this.userscript.internal_setSettings(this.settings); 163 this.userscript.internal_setSettings(this.settings);
@@ -233,7 +234,8 @@ class RecipeController {
233 console.log('Injecting DarkReader'); 234 console.log('Injecting DarkReader');
234 235
235 // Use darkreader instead 236 // Use darkreader instead
236 enableDarkMode({}, { 237 const { brightness, contrast, sepia } = this.settings.service.darkReaderSettings;
238 enableDarkMode({ brightness, contrast, sepia }, {
237 css: customDarkModeCss[window.location.host] || '', 239 css: customDarkModeCss[window.location.host] || '',
238 }); 240 });
239 this.universalDarkModeInjected = true; 241 this.universalDarkModeInjected = true;