From 4234e0418cef3adb71f27ea52a5d580c25774b8e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 2 Sep 2022 19:49:01 +0000 Subject: darkmode (2sep22) git-svn-id: svn://tug.org/texlive/trunk@64271 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/darkmode/darkmode.sty | 80 +++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/darkmode/darkmode.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/darkmode/darkmode.sty b/Master/texmf-dist/tex/latex/darkmode/darkmode.sty new file mode 100644 index 00000000000..a4841f8a889 --- /dev/null +++ b/Master/texmf-dist/tex/latex/darkmode/darkmode.sty @@ -0,0 +1,80 @@ +%% +%% This is file `darkmode.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% darkmode.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2022 by Ruben Deisenroth +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\RequirePackage{expl3,l3keys2e} +\ProvidesExplPackage {darkmode} {2022-09-01} {1.0.1} +{Provide general dark mode support for any LaTeX document.} + +\RequirePackage{xcolor,pagecolor} +\keys_define:nn {darkmode} { + enable .bool_gset:N = \g_@@_dark_mode_bool, + enable .initial:n = false, + enable .default:n = true, + defaulthook .bool_gset:N = \g_@@_dark_mode_hook_bool, + defaulthook .initial:n = true, + defaulthook .default:n = true, + nodefaulthook .meta:n = {defaulthook=false}, +} +\ProcessKeysOptions{darkmode} + +\prg_new_conditional:Nnn \__darkmode_if_dark_mode: {T,F,TF} { + \bool_if:NTF \g_@@_dark_mode_bool + {\prg_return_true:} + {\prg_return_false:} +} +\cs_set_eq:NN\IfDarkModeT \__darkmode_if_dark_mode:T +\cs_set_eq:NN\IfDarkModeF \__darkmode_if_dark_mode:F +\cs_set_eq:NN\IfDarkModeTF \__darkmode_if_dark_mode:TF +\definecolor{darkmode@anthrazitgrau}{HTML}{293133} +\colorlet{fgcolor}{.} +\DeclareDocumentCommand{\@darkmode@set@enabled}{}{ + \bool_set_true:c {g_@@_dark_mode_bool} +} +\DeclareDocumentCommand{\@darkmode@on@enable}{}{ + \pagecolor{darkmode@anthrazitgrau} + \color{white} + \selectcolormodel{RGB} + \colorlet{fgcolor}{.} +} +\DeclareDocumentCommand{\enabledarkmode}{}{ + \@darkmode@set@enabled + \bool_if:cT {g_@@_dark_mode_hook_bool} {\@darkmode@on@enable} +} +\DeclareDocumentCommand{\@darkmode@set@disabled}{}{ + \bool_set_false:c {g_@@_dark_mode_bool} +} +\DeclareDocumentCommand{\@darkmode@on@disable}{}{ + \pagecolor{white} + \color{black} + \colorlet{fgcolor}{.} +} +\DeclareDocumentCommand{\disabledarkmode}{}{ + \@darkmode@set@disabled + \bool_if:cT {g_@@_dark_mode_hook_bool} {\@darkmode@on@disable} +} +\DeclareDocumentCommand{\__darkmode_update_from_bool}{}{ + \IfDarkModeTF{\enabledarkmode}{\disabledarkmode} +} +\__darkmode_update_from_bool +\endinput +%% +%% End of file `darkmode.sty'. -- cgit v1.2.3