1
0

theming.scss 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. #body-login {
  147. input.primary:enabled:hover,
  148. input.primary:enabled:focus,
  149. button.primary:enabled:hover,
  150. button.primary:enabled:focus,
  151. a.primary:enabled:hover,
  152. a.primary:enabled:focus {
  153. color: $color-primary-text;
  154. background-image: linear-gradient(40deg, $color-primary 0%, lighten($color-primary, 20%) 100%);
  155. }
  156. }
  157. @if ($invert) {
  158. #body-login {
  159. .body-login-container {
  160. background-color: transparentize(nc-lighten($color-primary, 30%), 0.2);
  161. color: $color-primary-text !important;
  162. h2 {
  163. color: $color-primary-text;
  164. }
  165. .icon-search.icon-white {
  166. // CSS variable is not used here since it is on the public page layout,
  167. // where the dark theme doesn't apply at the moment
  168. background-image: url('../../../core/img/actions/search.svg');
  169. }
  170. }
  171. input,
  172. #alternative-logins li a {
  173. border: 1px solid nc-lighten($color-primary-text, 50%);
  174. }
  175. input.primary,
  176. button.primary,
  177. #alternative-logins li a {
  178. background-color: $color-primary;
  179. color: $color-primary-text;
  180. }
  181. a,
  182. label,
  183. footer p,
  184. #alternative-logins legend,
  185. .lost-password-container #lost-password,
  186. .warning, .update, .error {
  187. color: $color-primary-text !important;
  188. }
  189. input[type='checkbox'].checkbox--white + label:before {
  190. border-color: nc-darken($color-primary-element, 40%) !important;
  191. }
  192. input[type='checkbox'].checkbox--white:not(:disabled):not(:checked) + label:hover:before,
  193. input[type='checkbox'].checkbox--white:focus + label:before {
  194. border-color: nc-darken($color-primary-element, 30%) !important;
  195. }
  196. input[type='checkbox'].checkbox--white:checked + label:before {
  197. border-color: nc-darken($color-primary-element, 30%) !important;
  198. background-color: nc-darken($color-primary-element, 30%) !important;
  199. @include icon-color('checkbox-mark', 'actions', $color-white, 1, true);
  200. }
  201. #submit-wrapper .icon-confirm-white {
  202. background-image: url('../../../core/img/actions/confirm.svg');
  203. }
  204. .two-factor-provider {
  205. &:hover, &:focus {
  206. border-color: $color-primary-text;
  207. }
  208. img {
  209. filter: invert(1);
  210. }
  211. }
  212. }
  213. #body-public #header .icon-more-white {
  214. background-image: var(--icon-more-000);
  215. }
  216. }
  217. // plain background color for login page
  218. @if $image-login-plain == 'true' {
  219. #body-login, #firstrunwizard .firstrunwizard-header, #theming-preview {
  220. background-image: none !important;
  221. }
  222. #body-login {
  223. a, label, p {
  224. color: $color-primary-text;
  225. }
  226. }
  227. }
  228. /** Handle primary buttons for bright colors */
  229. @if (luma($color-primary) > 0.8) {
  230. select,
  231. button, .button,
  232. input:not([type='range']),
  233. textarea,
  234. div[contenteditable=true],
  235. .pager li a {
  236. &.primary:not(:disabled) {
  237. background-color: var(--color-background-dark);
  238. color: var(--color-main-text);
  239. border-color: var(--color-text-lighter);
  240. &:hover, &:focus, &:active {
  241. background-color: var(--color-background-darker);
  242. color: var(--color-main-text);
  243. border-color: var(--color-text);
  244. }
  245. }
  246. }
  247. }
  248. @if ($color-primary == #ffffff) {
  249. /* show grey border below header */
  250. #body-user #header,
  251. #body-settings #header,
  252. #body-public #header {
  253. border-bottom: 1px solid #ebebeb;
  254. }
  255. /* show triangle in header in grey */
  256. #appmenu li a.active:before,
  257. .header-right #settings #expand:before {
  258. border-bottom-color:#ebebeb;
  259. }
  260. /* show border around quota bar in files app */
  261. .app-files #quota .quota-container {
  262. border: 1px solid #ebebeb;
  263. }
  264. }
  265. @if ($has-legal-links == 'true') {
  266. footer {
  267. height: 92px;
  268. }
  269. }