From nobody Fri Jul 14 14:12:15 2023 X-Original-To: dev-commits-doc-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R2YMN1k3fz2ttJ9 for ; Fri, 14 Jul 2023 14:12:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R2YMN1WpVz4Mhw; Fri, 14 Jul 2023 14:12:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689343936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yTpcsrCbPMZzwNgB62I+12aqioZto9jYPbB/CS1mIFk=; b=dDfmHU1ypNLfvLfecvbt8aNNpUaeAIHnFYoPDzUZD9IU0p2/qq5k16wBU1J2/f9D0dsxXJ 35ueal/rhjOYdgaNHI5AT3HbQddKpE2vfzW3W9RAS758Fw8LvXBpkp4GHQs/3YrYtLEsUO qxj4GXJ3ZnihZNKQ+muMbIQ1fL8lx+aUhnZHSV7o4XvMrWTzN/FrB3bzZsJzn3l1PUehVu kxAQ1WPVyN4HJnXfod+dw/qAPjc51RkwBI5hmqQisQNenf8SNXv5zc//k6HR2jNl0W3n9r Uuf8JUJQf26FIrKCSbZ7Q76XlYIO01TygfJZjzNSpGeUnQm0AH+UMpkvoZ9w9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689343936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yTpcsrCbPMZzwNgB62I+12aqioZto9jYPbB/CS1mIFk=; b=PwiDq8wt//K3ELi1iyEHgK1CDS8UuPnQJ7o+Wjb2P4fyOTNF9vlvqUjF+CG15kEo6WWLgX dfJs2YxMi/NVgloy/ooYG/r0c8rQh0XNNhCWJXPHuS+Cf5bu7Ukfnu6quJGK6AwxgQVzg5 E4mumpLTakLkXgsSTSeK8jT/ExyjGZuWAa7wUf6h2LETK0nZrlD6VfvTHsUoPoPWXulEJa SxgiYTeovA+V59XQs5uKe/30C52J1OfXfrjREv+sVk+S2mMbsRSaER+/q6sNRaCF1x7Yp8 OEm6wSBJKAErg+/r1Lg9mdU4ikrtAzOCilbN+gqx80bv80xgJGcbH6zkp4ECwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689343936; a=rsa-sha256; cv=none; b=YizGM7h34VnweaiixGF0kITlYVR6ZgQ9se4Z97PUs+mQqEo/pH3c1xZHDlmGEzYFLY46p0 rOxE7vVPXxRBCJ+lWsbIU2rqI9pnrDFi0TKwouWWO8rRmmtG4i6O2D1Z+ug/k0E3bCaCMp eBu3iD+ipjnbtolU/NBjqJ8beJNYLo2pCosRJrRf2LPEk7NjlPKU098zKMAnO90BjQs1n/ kVrAQWWk8vKeyVd8RUGluJdyRZyFrSC/zvG1pg1RG2pgI3Hy0111FVp26z1IyJ/XPx7B6T Skf8kJs2X07gkq+0oz9NpL55But8KKt/mB0AQW9vjmy3AC8KDBxSXJJzx8kH6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R2YMN0ZhczLmy; Fri, 14 Jul 2023 14:12:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36EECFuR077047; Fri, 14 Jul 2023 14:12:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36EECF6a077046; Fri, 14 Jul 2023 14:12:15 GMT (envelope-from git) Date: Fri, 14 Jul 2023 14:12:15 GMT Message-Id: <202307141412.36EECF6a077046@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: Sergio Carlavilla Delgado Subject: git: fbf328b48f - main - Documentation theme: Add new system option to theme chooser List-Id: Commit messages for all branches of the doc repository List-Archive: https://lists.freebsd.org/archives/dev-commits-doc-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-doc-all@freebsd.org X-BeenThere: dev-commits-doc-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: carlavilla X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbf328b48f749b62f2166771e94b5cd0664dd52d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by carlavilla: URL: https://cgit.FreeBSD.org/doc/commit/?id=fbf328b48f749b62f2166771e94b5cd0664dd52d commit fbf328b48f749b62f2166771e94b5cd0664dd52d Author: Minsoo Choo AuthorDate: 2023-07-14 14:00:50 +0000 Commit: Sergio Carlavilla Delgado CommitDate: 2023-07-14 14:00:50 +0000 Documentation theme: Add new system option to theme chooser Add new 'system' option to the theme chooser. In this way the user will not have to select the theme and the system will choose it automatically based on the theme of the web browser Tested in: Chromium and Firefox in FreeBSD. Differential Revision: https://reviews.freebsd.org/D41024 --- .../themes/beastie/assets/js/theme-chooser.js | 20 +++++++++++++++++--- documentation/themes/beastie/i18n/bn-bd.toml | 2 ++ documentation/themes/beastie/i18n/da.toml | 3 +++ documentation/themes/beastie/i18n/de.toml | 3 +++ documentation/themes/beastie/i18n/el.toml | 3 +++ documentation/themes/beastie/i18n/en.toml | 3 +++ documentation/themes/beastie/i18n/es.toml | 3 +++ documentation/themes/beastie/i18n/fr.toml | 3 +++ documentation/themes/beastie/i18n/hu.toml | 3 +++ documentation/themes/beastie/i18n/it.toml | 3 +++ documentation/themes/beastie/i18n/ja.toml | 3 +++ documentation/themes/beastie/i18n/ko.toml | 3 +++ documentation/themes/beastie/i18n/mn.toml | 3 +++ documentation/themes/beastie/i18n/nl.toml | 3 +++ documentation/themes/beastie/i18n/pl.toml | 3 +++ documentation/themes/beastie/i18n/pt-br.toml | 3 +++ documentation/themes/beastie/i18n/ru.toml | 3 +++ documentation/themes/beastie/i18n/tr.toml | 3 +++ documentation/themes/beastie/i18n/zh-cn.toml | 3 +++ documentation/themes/beastie/i18n/zh-tw.toml | 3 +++ .../themes/beastie/layouts/partials/site-footer.html | 1 + .../themes/beastie/layouts/partials/site-head.html | 2 +- 22 files changed, 75 insertions(+), 4 deletions(-) diff --git a/documentation/themes/beastie/assets/js/theme-chooser.js b/documentation/themes/beastie/assets/js/theme-chooser.js index 40e4cd898f..d33f3d6f97 100644 --- a/documentation/themes/beastie/assets/js/theme-chooser.js +++ b/documentation/themes/beastie/assets/js/theme-chooser.js @@ -41,9 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } else if (theme === "theme-high-contrast") { setTheme('theme-high-contrast'); themeChooser.value = 'theme-high-contrast'; - } else { + } else if (theme === "theme-light") { setTheme('theme-light'); themeChooser.value = 'theme-light'; + } else { + setTheme('theme-system'); + themeChooser.value = 'theme-system'; } themeChooser.addEventListener('change', function() { @@ -53,13 +56,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. setTheme('theme-dark'); } else if (theme === "theme-high-contrast") { setTheme('theme-high-contrast'); - } else { + } else if (theme === "theme-light") { setTheme('theme-light'); + } else { + setTheme('theme-system'); } }); function setTheme(themeName) { localStorage.setItem('theme', themeName); - document.documentElement.className = themeName; + + if (themeName === 'theme-system') { + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + document.documentElement.className = 'theme-dark'; + } else { + document.documentElement.className = 'theme-light'; + } + } else { + document.documentElement.className = themeName; + } } })(); diff --git a/documentation/themes/beastie/i18n/bn-bd.toml b/documentation/themes/beastie/i18n/bn-bd.toml index 426f9f42ce..86a78009ba 100644 --- a/documentation/themes/beastie/i18n/bn-bd.toml +++ b/documentation/themes/beastie/i18n/bn-bd.toml @@ -115,6 +115,8 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/da.toml b/documentation/themes/beastie/i18n/da.toml index 426f9f42ce..edc3eb986b 100644 --- a/documentation/themes/beastie/i18n/da.toml +++ b/documentation/themes/beastie/i18n/da.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/de.toml b/documentation/themes/beastie/i18n/de.toml index 3d5543a006..68ba7e0f78 100644 --- a/documentation/themes/beastie/i18n/de.toml +++ b/documentation/themes/beastie/i18n/de.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/el.toml b/documentation/themes/beastie/i18n/el.toml index cd52247ffc..e01e2a0100 100644 --- a/documentation/themes/beastie/i18n/el.toml +++ b/documentation/themes/beastie/i18n/el.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/en.toml b/documentation/themes/beastie/i18n/en.toml index b4f5a837e0..0f2eb26e91 100644 --- a/documentation/themes/beastie/i18n/en.toml +++ b/documentation/themes/beastie/i18n/en.toml @@ -199,6 +199,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/es.toml b/documentation/themes/beastie/i18n/es.toml index 82acd0af90..2330482edd 100644 --- a/documentation/themes/beastie/i18n/es.toml +++ b/documentation/themes/beastie/i18n/es.toml @@ -115,6 +115,9 @@ other = "Páginas del Manual de FreeBSD" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Claro" diff --git a/documentation/themes/beastie/i18n/fr.toml b/documentation/themes/beastie/i18n/fr.toml index 189d785227..91a9b435b4 100644 --- a/documentation/themes/beastie/i18n/fr.toml +++ b/documentation/themes/beastie/i18n/fr.toml @@ -115,6 +115,9 @@ other = "Pages de manuel FreeBSD" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Clair" diff --git a/documentation/themes/beastie/i18n/hu.toml b/documentation/themes/beastie/i18n/hu.toml index 1b00390645..acb13b242f 100644 --- a/documentation/themes/beastie/i18n/hu.toml +++ b/documentation/themes/beastie/i18n/hu.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/it.toml b/documentation/themes/beastie/i18n/it.toml index 227aea174e..c3b9752c25 100644 --- a/documentation/themes/beastie/i18n/it.toml +++ b/documentation/themes/beastie/i18n/it.toml @@ -115,6 +115,9 @@ other = "FreeBSD man page" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/ja.toml b/documentation/themes/beastie/i18n/ja.toml index ea52c990c7..cb19b3fdbf 100644 --- a/documentation/themes/beastie/i18n/ja.toml +++ b/documentation/themes/beastie/i18n/ja.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/ko.toml b/documentation/themes/beastie/i18n/ko.toml index 426f9f42ce..edc3eb986b 100644 --- a/documentation/themes/beastie/i18n/ko.toml +++ b/documentation/themes/beastie/i18n/ko.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/mn.toml b/documentation/themes/beastie/i18n/mn.toml index 4be6fcd9af..218b61786e 100644 --- a/documentation/themes/beastie/i18n/mn.toml +++ b/documentation/themes/beastie/i18n/mn.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/nl.toml b/documentation/themes/beastie/i18n/nl.toml index a6c9cd516e..6a2e71de7d 100644 --- a/documentation/themes/beastie/i18n/nl.toml +++ b/documentation/themes/beastie/i18n/nl.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/pl.toml b/documentation/themes/beastie/i18n/pl.toml index 426f9f42ce..edc3eb986b 100644 --- a/documentation/themes/beastie/i18n/pl.toml +++ b/documentation/themes/beastie/i18n/pl.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/pt-br.toml b/documentation/themes/beastie/i18n/pt-br.toml index 2db88d801d..448774c675 100644 --- a/documentation/themes/beastie/i18n/pt-br.toml +++ b/documentation/themes/beastie/i18n/pt-br.toml @@ -115,6 +115,9 @@ other = "Páginas de Manual do FreeBSD" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/ru.toml b/documentation/themes/beastie/i18n/ru.toml index ad49eb685c..187a9c1954 100644 --- a/documentation/themes/beastie/i18n/ru.toml +++ b/documentation/themes/beastie/i18n/ru.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/tr.toml b/documentation/themes/beastie/i18n/tr.toml index 426f9f42ce..edc3eb986b 100644 --- a/documentation/themes/beastie/i18n/tr.toml +++ b/documentation/themes/beastie/i18n/tr.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/zh-cn.toml b/documentation/themes/beastie/i18n/zh-cn.toml index 1d06a3ef12..db6a1e628e 100644 --- a/documentation/themes/beastie/i18n/zh-cn.toml +++ b/documentation/themes/beastie/i18n/zh-cn.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "Light" diff --git a/documentation/themes/beastie/i18n/zh-tw.toml b/documentation/themes/beastie/i18n/zh-tw.toml index 38234e8756..000f75ff9a 100644 --- a/documentation/themes/beastie/i18n/zh-tw.toml +++ b/documentation/themes/beastie/i18n/zh-tw.toml @@ -115,6 +115,9 @@ other = "FreeBSD Manual Pages" # --------------------------------------------------- # Footer # --------------------------------------------------- +[system] +other = "System" + [light] other = "淺色" diff --git a/documentation/themes/beastie/layouts/partials/site-footer.html b/documentation/themes/beastie/layouts/partials/site-footer.html index d16dd23b9d..aab2506f36 100755 --- a/documentation/themes/beastie/layouts/partials/site-footer.html +++ b/documentation/themes/beastie/layouts/partials/site-footer.html @@ -17,6 +17,7 @@ {{ end }}