1
0

DarkHighContrastTheme.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author John Molakvoæ <skjnldsv@protonmail.com>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCA\Theming\Themes;
  26. use OCA\Theming\ITheme;
  27. class DarkHighContrastTheme extends DarkTheme implements ITheme {
  28. public function getId(): string {
  29. return 'dark-highcontrast';
  30. }
  31. public function getMediaQuery(): string {
  32. return '(prefers-color-scheme: dark) and (prefers-contrast: more)';
  33. }
  34. public function getTitle(): string {
  35. return $this->l->t('Dark theme with high contrast mode');
  36. }
  37. public function getEnableLabel(): string {
  38. return $this->l->t('Enable dark high contrast mode');
  39. }
  40. public function getDescription(): string {
  41. return $this->l->t('Similar to the high contrast mode, but with dark colours.');
  42. }
  43. /**
  44. * Keep this consistent with other HighContrast Themes
  45. */
  46. public function getCSSVariables(): array {
  47. $defaultVariables = parent::getCSSVariables();
  48. $colorMainText = '#ffffff';
  49. $colorMainBackground = '#000000';
  50. $colorMainBackgroundRGB = join(',', $this->util->hexToRGB($colorMainBackground));
  51. return array_merge(
  52. $defaultVariables,
  53. $this->generatePrimaryVariables($colorMainBackground, $colorMainText),
  54. [
  55. '--color-main-background' => $colorMainBackground,
  56. '--color-main-background-rgb' => $colorMainBackgroundRGB,
  57. '--color-main-background-translucent' => 'rgba(var(--color-main-background-rgb), 1)',
  58. '--color-main-text' => $colorMainText,
  59. '--color-background-dark' => $this->util->lighten($colorMainBackground, 30),
  60. '--color-background-darker' => $this->util->lighten($colorMainBackground, 30),
  61. '--color-main-background-blur' => $colorMainBackground,
  62. '--filter-background-blur' => 'none',
  63. '--color-placeholder-light' => $this->util->lighten($colorMainBackground, 30),
  64. '--color-placeholder-dark' => $this->util->lighten($colorMainBackground, 45),
  65. '--color-text-maxcontrast' => $colorMainText,
  66. '--color-text-maxcontrast-background-blur' => $colorMainText,
  67. '--color-text-light' => $colorMainText,
  68. '--color-text-lighter' => $colorMainText,
  69. '--color-scrollbar' => $this->util->lighten($colorMainBackground, 35),
  70. // used for the icon loading animation
  71. '--color-loading-light' => '#000000',
  72. '--color-loading-dark' => '#dddddd',
  73. '--color-box-shadow-rgb' => $colorMainText,
  74. '--color-box-shadow' => $colorMainText,
  75. '--color-border' => $this->util->lighten($colorMainBackground, 50),
  76. '--color-border-dark' => $this->util->lighten($colorMainBackground, 50),
  77. ]
  78. );
  79. }
  80. public function getCustomCss(): string {
  81. return "
  82. [class^='icon-'], [class*=' icon-'],
  83. .action,
  84. #appmenu li a,
  85. .menutoggle {
  86. opacity: 1 !important;
  87. }
  88. #app-navigation {
  89. border-right: 1px solid var(--color-border);
  90. }
  91. div.crumb {
  92. filter: brightness(150%);
  93. }
  94. ";
  95. }
  96. }