theming.scss 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. /** Calculate luma as it is also used in OCA\Theming\Util::calculateLuma */
  2. @function luma($c) {
  3. $-local-red: red(rgba($c, 1.0));
  4. $-local-green: green(rgba($c, 1.0));
  5. $-local-blue: blue(rgba($c, 1.0));
  6. @return (0.2126 * $-local-red + 0.7152 * $-local-green + 0.0722 * $-local-blue) / 255;
  7. }
  8. @mixin faded-background {
  9. background-color: $color-primary;
  10. @if ($color-primary == #0082C9) {
  11. background-image: linear-gradient(40deg, $color-primary 0%, lighten($color-primary, 20%) 100%);
  12. } @else {
  13. /** This will be overwritten by the faded-background-image mixin if needed */
  14. background-image: none;
  15. }
  16. }
  17. @mixin faded-background-image {
  18. @include faded-background;
  19. background-size: contain;
  20. @if ($color-primary == #0082C9) {
  21. background-image: $image-login-background, linear-gradient(40deg, $color-primary 0%, lighten($color-primary, 20%) 100%);
  22. }
  23. @if($has-custom-background == true) {
  24. background-size: cover;
  25. background-repeat: no-repeat;
  26. background-image: $image-login-background;
  27. }
  28. }
  29. $has-custom-background: variable_exists('theming-background-mime') and $theming-background-mime != '';
  30. $has-custom-logo: variable_exists('theming-logo-mime') and $theming-logo-mime != '';
  31. $invert: luma($color-primary) > 0.6;
  32. @if ($has-custom-logo == false) {
  33. @if ($invert) {
  34. $image-logo: url(icon-color-path('logo', 'logo', #000000, 1, true));
  35. } @else {
  36. $image-logo: url(icon-color-path('logo', 'logo', #ffffff, 1, true));
  37. }
  38. }
  39. .nc-theming-main-background {
  40. background-color: $color-primary;
  41. }
  42. .nc-theming-main-text {
  43. color: $color-primary-text;
  44. }
  45. .nc-theming-contrast {
  46. color: $color-primary-text;
  47. }
  48. @if ($invert) {
  49. // too bright, use dark text to mix the primary
  50. $color-primary-light: mix($color-primary, $color-main-text, 10%);
  51. #appmenu:not(.inverted) svg {
  52. filter: invert(1);
  53. }
  54. #appmenu.inverted svg {
  55. filter: none;
  56. }
  57. .searchbox input[type="search"] {
  58. background-repeat: no-repeat;
  59. background-position: 6px center;
  60. background-color: transparent;
  61. @include icon-color('search', 'actions', $color-black, 1, true);
  62. }
  63. #contactsmenu .icon-contacts {
  64. @include icon-color('contacts', 'places', $color-black, 1, true);
  65. }
  66. #settings .icon-settings-white {
  67. @include icon-color('settings', 'actions', $color-black, 1, true);
  68. }
  69. #appmenu .icon-more-white {
  70. @include icon-color('more', 'actions', $color-black, 1, true);
  71. }
  72. } @else {
  73. #appmenu:not(.inverted) svg {
  74. filter: none;
  75. }
  76. #appmenu.inverted svg {
  77. filter: invert(1);
  78. }
  79. }
  80. /* Colorized svg images */
  81. .icon-file, .icon-filetype-text {
  82. background-image: url(./img/core/filetypes/text.svg?v=#{$theming-cachebuster});
  83. }
  84. .icon-folder, .icon-filetype-folder {
  85. background-image: url(./img/core/filetypes/folder.svg?v=#{$theming-cachebuster});
  86. }
  87. .icon-filetype-folder-drag-accept {
  88. background-image: url(./img/core/filetypes/folder-drag-accept.svg?v=#{$theming-cachebuster}) !important;
  89. }
  90. #theming-preview-logo,
  91. #header .logo {
  92. background-image: $image-logo;
  93. }
  94. #body-user #header, #body-settings #header, #body-public #header {
  95. @include faded-background;
  96. }
  97. #body-login,
  98. #firstrunwizard .firstrunwizard-header,
  99. #theming-preview {
  100. @include faded-background-image;
  101. }
  102. /* override styles for login screen in guest.css */
  103. @if ($has-custom-logo) {
  104. // custom logo
  105. #theming-preview-logo,
  106. #header .logo {
  107. background-size: contain;
  108. }
  109. #body-login #header .logo {
  110. margin-bottom: 22px;
  111. }
  112. } @else {
  113. // default logo
  114. @if ($invert) {
  115. #theming-preview-logo,
  116. #header .logo {
  117. opacity: .6;
  118. }
  119. }
  120. }
  121. @if variable_exists('theming-logoheader-mime') and $theming-logoheader-mime != '' {
  122. #theming .advanced-option-logoheader .image-preview,
  123. body:not(#body-login) #header .logo {
  124. background-image: $image-logoheader;
  125. }
  126. } @else {
  127. #theming .advanced-option-favicon .image-preview {
  128. background-image: none;
  129. }
  130. }
  131. @if variable_exists('theming-favicon-mime') and $theming-favicon-mime != '' {
  132. #theming .advanced-option-favicon .image-preview {
  133. background-image: $image-favicon;
  134. }
  135. } @else {
  136. #theming .advanced-option-favicon .image-preview {
  137. background-image: none;
  138. }
  139. }
  140. input.primary,
  141. #alternative-logins li a {
  142. background-color: $color-primary-element;
  143. border: 1px solid $color-primary-text;
  144. color: $color-primary-text;
  145. }
  146. @if ($invert) {
  147. #body-login {
  148. .body-login-container {
  149. background-color: transparentize(nc-lighten($color-primary, 30%), 0.2);
  150. color: $color-primary-text !important;
  151. h2 {
  152. color: $color-primary-text;
  153. }
  154. .icon-search.icon-white {
  155. // CSS variable is not used here since it is on the public page layout,
  156. // where the dark theme doesn't apply at the moment
  157. background-image: url('../../../core/img/actions/search.svg');
  158. }
  159. }
  160. input,
  161. #alternative-logins li a {
  162. border: 1px solid nc-lighten($color-primary-text, 50%);
  163. }
  164. input.primary,
  165. button.primary,
  166. #alternative-logins li a {
  167. background-color: $color-primary;
  168. color: $color-primary-text;
  169. }
  170. a,
  171. label,
  172. footer p,
  173. #alternative-logins legend,
  174. .lost-password-container #lost-password,
  175. .warning, .update, .error {
  176. color: $color-primary-text !important;
  177. }
  178. input[type='checkbox'].checkbox--white + label:before {
  179. border-color: nc-darken($color-primary-element, 40%) !important;
  180. }
  181. input[type='checkbox'].checkbox--white:not(:disabled):not(:checked) + label:hover:before,
  182. input[type='checkbox'].checkbox--white:focus + label:before {
  183. border-color: nc-darken($color-primary-element, 30%) !important;
  184. }
  185. input[type='checkbox'].checkbox--white:checked + label:before {
  186. border-color: nc-darken($color-primary-element, 30%) !important;
  187. background-color: nc-darken($color-primary-element, 30%) !important;
  188. @include icon-color('checkbox-mark', 'actions', $color-white, 1, true);
  189. }
  190. #submit-wrapper .icon-confirm-white {
  191. background-image: url('../../../core/img/actions/confirm.svg');
  192. }
  193. .two-factor-provider {
  194. &:hover, &:focus {
  195. border-color: $color-primary-text;
  196. }
  197. img {
  198. filter: invert(1);
  199. }
  200. }
  201. }
  202. #body-public #header .icon-more-white {
  203. background-image: var(--icon-more-000);
  204. }
  205. }
  206. // plain background color for login page
  207. @if $image-login-plain == 'true' {
  208. #body-login, #firstrunwizard .firstrunwizard-header, #theming-preview {
  209. background-image: none !important;
  210. }
  211. #body-login {
  212. a, label, p {
  213. color: $color-primary-text;
  214. }
  215. }
  216. }
  217. /** Handle primary buttons for bright colors */
  218. @if (luma($color-primary) > 0.8) {
  219. select,
  220. button, .button,
  221. input:not([type='range']),
  222. textarea,
  223. div[contenteditable=true],
  224. .pager li a {
  225. &.primary:not(:disabled) {
  226. background-color: var(--color-background-dark);
  227. color: var(--color-main-text);
  228. border-color: var(--color-text-lighter);
  229. &:hover, &:focus, &:active {
  230. background-color: var(--color-background-darker);
  231. color: var(--color-main-text);
  232. border-color: var(--color-text);
  233. }
  234. }
  235. }
  236. }
  237. @if ($color-primary == #ffffff) {
  238. /* show grey border below header */
  239. #body-user #header,
  240. #body-settings #header,
  241. #body-public #header {
  242. border-bottom: 1px solid #ebebeb;
  243. }
  244. /* show triangle in header in grey */
  245. #appmenu li a.active:before,
  246. .header-right #settings #expand:before {
  247. border-bottom-color:#ebebeb;
  248. }
  249. /* show border around quota bar in files app */
  250. .app-files #quota .quota-container {
  251. border: 1px solid #ebebeb;
  252. }
  253. }
  254. @if ($has-legal-links == 'true') {
  255. footer {
  256. height: 92px;
  257. }
  258. }