Skip to content

Commit

Permalink
feat: Add option to choose switcher appearance
Browse files Browse the repository at this point in the history
Change the way the switcher looks by adjusting the appearance.
  • Loading branch information
robhuijben authored Feb 29, 2024
2 parents 16d3ad3 + 6aa6b28 commit 9daa4c0
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 22 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ jobs:
id: get-latest-tag
run: echo "LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV

- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }}"
file_pattern: CHANGELOG.md

- name: Create package
run: |
cd ${{ github.workspace }}
Expand All @@ -41,10 +48,3 @@ jobs:
files: ./mod_darkmode-${{ env.LATEST_TAG }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }}"
file_pattern: CHANGELOG.md
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,25 @@ This module adds a simple switcher to your Joomla! 5 website to allow users to s

The module will add a switcher to your administration dashboard. Users with backend access can click the switcher to toggle between light and dark mode.

## Features

- Simple switcher to toggle between light and dark mode
- Available in 9 languages
- Choose appearance of icon and label or icon only

## Languages

The module is available in the following languages:

- English
- German
- French
- Spanish
- Italian
- Dutch
- Portuguese
- Russian
- Polish
- 🇬🇧 English
- 🇩🇪 German
- 🇫🇷 French
- 🇪🇸 Spanish
- 🇮🇹 Italian
- 🇳🇱 Dutch
- 🇵🇹 Portuguese
- 🇷🇺 Russian
- 🇵🇱 Polish

## Support

Expand Down
4 changes: 4 additions & 0 deletions language/de-DE/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Heller Modus"
MOD_DARKMODE_SWITCHER="Modus umschalten"
MOD_DARKMODE_DESC="Ein Administrationsmodul zum Wechseln zwischen dunklem und hellem Modus."
MOD_DARKMODE_XML_DESCRIPTION="<br>Dieses Modul ermöglicht es den Backend-Benutzern, zwischen dunklem und hellem Modus zu wechseln.<br><ul><li>Setzen Sie <strong>Position</strong> auf <code>status</code>, um den Umschalter in der Statusleiste anzuzeigen.</li><li>Setzen Sie <strong>Title</strong> auf 'Ausblenden', um den Titel auszublenden.</li><li>Veröffentlichen Sie das Modul und Sie sind bereit zu gehen.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Ändere Aussehen"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Ändere das Aussehen des Schalters."
MOD_DARKMODE_LABEL_ENABLE="Label und Symbol anzeigen"
MOD_DARKMODE_LABEL_DISABLE="Nur das Symbol anzeigen"
6 changes: 5 additions & 1 deletion language/en-GB/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ MOD_DARKMODE_DARK="Dark Mode"
MOD_DARKMODE_LIGHT="Light Mode"
MOD_DARKMODE_SWITCHER="Switch Dark Mode"
MOD_DARKMODE_DESC="An administrator module to switch between dark and light mode."
MOD_DARKMODE_XML_DESCRIPTION="<br>This module enables the backend users to switch between dark and light mode.<br><ul><li>Set <strong>Position</strong> to <code>status</code> to display the switcher in the status bar.</li><li>Set <strong>Title</strong> display to 'Hide'.</li><li>Publish the module and you are ready to go.</li></ul>"
MOD_DARKMODE_XML_DESCRIPTION="<br>This module enables the backend users to switch between dark and light mode.<br><ul><li>Set <strong>Position</strong> to <code>status</code> to display the switcher in the status bar.</li><li>Set <strong>Title</strong> display to 'Hide'.</li><li>Publish the module and you are ready to go.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Toggle appearance"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Change the way the toggle looks."
MOD_DARKMODE_LABEL_ENABLE="Show label and icon"
MOD_DARKMODE_LABEL_DISABLE="Show icon only"
4 changes: 4 additions & 0 deletions language/es-ES/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Modo Claro"
MOD_DARKMODE_SWITCHER="Cambiar Modo"
MOD_DARKMODE_DESC="Un módulo de administración para cambiar entre el modo oscuro y el modo claro."
MOD_DARKMODE_XML_DESCRIPTION="<br>Este módulo permite a los usuarios del backend cambiar entre el modo oscuro y el modo claro.<br><ul><li>Establezca <strong>Position</strong> en <code>status</code> para mostrar el interruptor en la barra de estado.</li><li>Establezca <strong>Title</strong> en 'Ocultar' para ocultar el título.</li><li>Publique el módulo y estará listo para usar.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Cambiar apariencia"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Cambiar la apariencia del interruptor."
MOD_DARKMODE_LABEL_ENABLE="Mostrar etiqueta e icono"
MOD_DARKMODE_LABEL_DISABLE="Mostrar solo el icono"
4 changes: 4 additions & 0 deletions language/fr-FR/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Mode clair"
MOD_DARKMODE_SWITCHER="Basculer le mode sombre"
MOD_DARKMODE_DESC="Un module d'administration pour basculer entre le mode sombre et le mode clair."
MOD_DARKMODE_XML_DESCRIPTION="<br>Ce module permet aux utilisateurs de l'interface d'administration de basculer entre le mode sombre et le mode clair.<br><ul><li>Définissez <strong>Position</strong> sur <code>status</code> pour afficher le commutateur dans la barre d'état.</li><li>Définissez <strong>Title</strong> sur 'Hide' pour masquer le titre.</li><li>Publiez le module et vous êtes prêt à partir.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Changer l'apparence"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Changer l'apparence de l'interrupteur."
MOD_DARKMODE_LABEL_ENABLE="Afficher l'étiquette et l'icône"
MOD_DARKMODE_LABEL_DISABLE="Afficher uniquement l'icône"
4 changes: 4 additions & 0 deletions language/it-IT/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Modalità chiara"
MOD_DARKMODE_SWITCHER="Cambia modalità scura"
MOD_DARKMODE_DESC="Un modulo amministratore per passare dalla modalità scura alla modalità chiara."
MOD_DARKMODE_XML_DESCRIPTION="<br>Questo modulo consente agli utenti del backend di passare dalla modalità scura alla modalità chiara.<br><ul><li>Imposta <strong>Posizione</strong> su <code>status</code> per visualizzare il selettore nella barra di stato.</li><li>Imposta <strong>Titolo</strong> su 'Nascondi'.</li><li>Pubblica il modulo e sei pronto per iniziare.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Cambia aspetto"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Cambia l'aspetto dell'interruttore."
MOD_DARKMODE_LABEL_ENABLE="Mostra etichetta e icona"
MOD_DARKMODE_LABEL_DISABLE="Mostra solo l'icona"
4 changes: 4 additions & 0 deletions language/nl-NL/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Lichte modus"
MOD_DARKMODE_SWITCHER="Schakel donkere modus"
MOD_DARKMODE_DESC="Een beheermodule om te schakelen tussen donkere en lichte modus."
MOD_DARKMODE_XML_DESCRIPTION="<br>Deze module stelt backend-gebruikers in staat om te schakelen tussen donkere en lichte modus.<br><ul><li>Stel <strong>Position</strong> in op <code>status</code> om de schakelaar weer te geven in de statusbalk.</li><li>Stel <strong>Title</strong> in op 'Verbergen'.</li><li>Publiceer de module en je bent klaar om te gaan.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Verander uiterlijk"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Verander het uiterlijk van de schakelaar."
MOD_DARKMODE_LABEL_ENABLE="Toon label en pictogram"
MOD_DARKMODE_LABEL_DISABLE="Toon alleen het pictogram"
4 changes: 4 additions & 0 deletions language/pl-PL/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Tryb jasny"
MOD_DARKMODE_SWITCHER="Przełącz tryb ciemny"
MOD_DARKMODE_DESC="Moduł zarządzania przełączaniem między trybem ciemnym a jasnym."
MOD_DARKMODE_XML_DESCRIPTION="<br>Ten moduł umożliwia użytkownikom backendu przełączanie między trybem ciemnym a jasnym.<br><ul><li>Ustaw <strong>Pozycję</strong> na <code>status</code>, aby wyświetlić przełącznik w pasku stanu.</li><li>Ustaw <strong>Tytuł</strong> na 'Ukryj'.</li><li>Opublikuj moduł i gotowe.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Zmień wygląd"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Zmień wygląd przełącznika."
MOD_DARKMODE_LABEL_ENABLE="Wyświetlaj etykietę i symbol"
MOD_DARKMODE_LABEL_DISABLE="Wyświetlaj tylko symbol"
4 changes: 4 additions & 0 deletions language/pt-PT/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Modo Claro"
MOD_DARKMODE_SWITCHER="Alternar Modo Escuro"
MOD_DARKMODE_DESC="Um módulo de administrador para alternar entre o modo escuro e o modo claro."
MOD_DARKMODE_XML_DESCRIPTION="<br>Este módulo permite que os usuários do backend alternem entre o modo escuro e o modo claro.<br><ul><li>Defina <strong>Posição</strong> como <code>status</code> para exibir o alternador na barra de status.</li><li>Defina <strong>Título</strong> como 'Ocultar'.</li><li>Publique o módulo e você estará pronto para começar.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Alterar aparência"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Alterar aparência do interruptor."
MOD_DARKMODE_LABEL_ENABLE="Exibir rótulo e símbolo"
MOD_DARKMODE_LABEL_DISABLE="Exibir apenas símbolo"
4 changes: 4 additions & 0 deletions language/ru-RU/mod_darkmode.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ MOD_DARKMODE_LIGHT="Светлый режим"
MOD_DARKMODE_SWITCHER="Переключить темный режим"
MOD_DARKMODE_DESC="Модуль администратора для переключения между темным и светлым режимами."
MOD_DARKMODE_XML_DESCRIPTION="<br>Этот модуль позволяет пользователям административной панели переключаться между темным и светлым режимами.<br><ul><li>Установите <strong>Position</strong> в значение <code>status</code>, чтобы отображать переключатель в строке состояния.</li><li>Установите <strong>Title</strong> в значение 'Скрыть'.</li><li>Опубликуйте модуль и вы готовы к работе.</li></ul>"
MOD_DARKMODE_FIELD_DARKMODE_LABEL="Изменить внешний вид"
MOD_DARKMODE_FIELD_DARKMODE_DESC="Изменить внешний вид переключателя."
MOD_DARKMODE_LABEL_ENABLE="Показывать метку и символ"
MOD_DARKMODE_LABEL_DISABLE="Показывать только символ"
6 changes: 3 additions & 3 deletions manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<description><![CDATA[The Dark Mode Switcher module enables the backend users to switch between dark and light mode.]]></description>
<element>mod_darkmode</element>
<type>module</type>
<version>0.1.1</version>
<version>0.2.0</version>
<client>administrator</client>
<infourl title="Extension Info">https://github.com/robhuijben/mod_darkmode/releases/tag/0.1.1</infourl>
<infourl title="Extension Info">https://github.com/robhuijben/mod_darkmode/releases/tag/0.2.0</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/robhuijben/mod_darkmode/archive/refs/tags/0.1.1.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/robhuijben/mod_darkmode/releases/download/0.2.0/mod_darkmode-0.2.0zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
Expand Down
2 changes: 2 additions & 0 deletions mod_darkmode.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@

\defined('_JEXEC') or die;

$switcherLabel = $params->get('switcher_label', 0);

require \Joomla\CMS\Helper\ModuleHelper::getLayoutPath('mod_darkmode', $params->get('layout', 'default'));
12 changes: 11 additions & 1 deletion mod_darkmode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later; see LICENSE.md</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.robhuijben.com</authorUrl>
<version>0.1.1</version>
<version>0.1.2</version>
<description>MOD_DARKMODE_XML_DESCRIPTION</description>
<files>
<filename module="mod_darkmode">mod_darkmode.php</filename>
Expand Down Expand Up @@ -36,6 +36,16 @@
<language tag="pl-PL">language/pl-PL/mod_darkmode.ini</language>
<language tag="pl-PL">language/pl-PL/mod_darkmode.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="switcher_label" type="radio" default="0" label="MOD_DARKMODE_FIELD_DARKMODE_LABEL" description="MOD_DARKMODE_FIELD_DARKMODE_DESC">
<option value="0">MOD_DARKMODE_LABEL_ENABLE</option>
<option value="1">MOD_DARKMODE_LABEL_DISABLE</option>
</field>
</fieldset>
</fields>
</config>
<updateservers>
<server type="extension" name="Dark Mode Switcher Update Site">https://raw.githubusercontent.com/robhuijben/mod_darkmode/main/manifest.xml</server>
</updateservers>
Expand Down
4 changes: 3 additions & 1 deletion tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
<span class="header-item-icon">
<span style="margin: 3px; font-size: 1.2rem; transition: all .6s ease;">🌓</span>
</span>
<span class="header-item-text"><?php echo Text::_('MOD_DARKMODE_SWITCHER'); ?></span>
<?php if ($switcherLabel == false) : ?>
<span class="header-item-text"><?php echo Text::_('MOD_DARKMODE_SWITCHER'); ?></span>
<?php endif; ?>
</button>

0 comments on commit 9daa4c0

Please sign in to comment.