Browse Source

Theme (#1340)

* Add export

* Export feature.

* dark-theme

* Dark theme.

* Create screenshots

* Add snapshots

* Fix tests.

* Update snapshots.
pull/1343/head
Sebastian Stehle 2 months ago
committed by GitHub
parent
commit
ec846c8b01
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 19
      .github/workflows/dev.yml
  2. 1
      CLAUDE.md
  3. 6
      backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentFlowStep.cs
  4. 4
      backend/i18n/frontend_de.json
  5. 4
      backend/i18n/frontend_en.json
  6. 4
      backend/i18n/frontend_fr.json
  7. 4
      backend/i18n/frontend_it.json
  8. 4
      backend/i18n/frontend_nl.json
  9. 4
      backend/i18n/frontend_pt.json
  10. 4
      backend/i18n/frontend_zh.json
  11. 4
      backend/i18n/source/frontend_de.json
  12. 4
      backend/i18n/source/frontend_en.json
  13. 4
      backend/i18n/source/frontend_fr.json
  14. 4
      backend/i18n/source/frontend_it.json
  15. 4
      backend/i18n/source/frontend_nl.json
  16. 4
      backend/i18n/source/frontend_pt.json
  17. 4
      backend/i18n/source/frontend_zh.json
  18. 6
      backend/src/Squidex.Domain.Apps.Entities/Backup/BackupJob.cs
  19. 2
      backend/src/Squidex.Domain.Apps.Entities/Jobs/JobProcessor.cs
  20. 73
      backend/src/Squidex/Areas/Api/Views/Shared/Docs.cshtml
  21. 13
      backend/src/Squidex/Areas/IdentityServer/Views/_Layout.cshtml
  22. 381
      backend/src/Squidex/wwwroot/editor/squidex-editor.js
  23. 108
      backend/src/Squidex/wwwroot/images/dashboard-api.svg
  24. 119
      backend/src/Squidex/wwwroot/images/dashboard-feedback.svg
  25. 38
      backend/src/Squidex/wwwroot/scripts/editor-sdk.d.ts
  26. 111
      backend/src/Squidex/wwwroot/scripts/editor-sdk.js
  27. 3
      frontend/src/app/app.component.ts
  28. 9
      frontend/src/app/declarations.d.ts
  29. 2
      frontend/src/app/features/administration/pages/event-consumers/event-consumers-page.component.scss
  30. 15
      frontend/src/app/features/api/pages/graphql/graphql-page.component.scss
  31. 25
      frontend/src/app/features/api/pages/graphql/graphql-page.component.ts
  32. 2
      frontend/src/app/features/apps/pages/app.component.scss
  33. 2
      frontend/src/app/features/apps/pages/news-dialog.component.scss
  34. 2
      frontend/src/app/features/apps/pages/onboarding-dialog.component.scss
  35. 4
      frontend/src/app/features/content/pages/content/content-page.component.scss
  36. 4
      frontend/src/app/features/content/pages/contents/contents-page.component.scss
  37. 15
      frontend/src/app/features/content/shared/content-extension.component.ts
  38. 4
      frontend/src/app/features/content/shared/forms/assets-editor.component.scss
  39. 2
      frontend/src/app/features/content/shared/forms/content-field.component.scss
  40. 6
      frontend/src/app/features/content/shared/forms/field-editor.component.scss
  41. 2
      frontend/src/app/features/content/shared/forms/iframe-editor.component.scss
  42. 15
      frontend/src/app/features/content/shared/forms/iframe-editor.component.ts
  43. 6
      frontend/src/app/features/content/shared/forms/stock-photo-editor.component.scss
  44. 6
      frontend/src/app/features/content/shared/list/content.component.scss
  45. 2
      frontend/src/app/features/content/shared/references/reference-item.component.scss
  46. 2
      frontend/src/app/features/content/shared/references/references-editor.component.scss
  47. 2
      frontend/src/app/features/dashboard/pages/dashboard-page.component.scss
  48. 4
      frontend/src/app/features/rules/pages/rule/branch.component.scss
  49. 10
      frontend/src/app/features/rules/pages/rule/rule-page.component.scss
  50. 2
      frontend/src/app/features/rules/shared/history-step.component.scss
  51. 2
      frontend/src/app/features/rules/shared/rule-element.component.scss
  52. 3
      frontend/src/app/features/schemas/pages/schema/fields/field-group.component.scss
  53. 10
      frontend/src/app/features/schemas/pages/schema/fields/field.component.scss
  54. 2
      frontend/src/app/features/schemas/pages/schema/fields/schema-fields.component.scss
  55. 2
      frontend/src/app/features/schemas/pages/schema/indexes/schema-indexes.component.scss
  56. 2
      frontend/src/app/features/schemas/pages/schema/ui/field-list.component.scss
  57. 2
      frontend/src/app/features/settings/pages/clients/client-connect-form.component.scss
  58. 3
      frontend/src/app/features/settings/pages/languages/language.component.scss
  59. 20
      frontend/src/app/features/settings/pages/script-logs/script-log.component.scss
  60. 35
      frontend/src/app/features/settings/pages/workflows/workflow-diagram.component.ts
  61. 2
      frontend/src/app/features/teams/pages/dashboard/dashboard-page.component.scss
  62. 2
      frontend/src/app/framework/angular/dropdown-menu.component.scss
  63. 6
      frontend/src/app/framework/angular/forms/editors/code-editor.component.scss
  64. 12
      frontend/src/app/framework/angular/forms/editors/code-editor.component.ts
  65. 1
      frontend/src/app/framework/angular/forms/editors/dropdown.component.scss
  66. 3
      frontend/src/app/framework/angular/forms/editors/stars.component.scss
  67. 8
      frontend/src/app/framework/angular/forms/editors/tag-editor.component.scss
  68. 4
      frontend/src/app/framework/angular/forms/editors/toggle.component.scss
  69. 3
      frontend/src/app/framework/angular/forms/form-alert.component.scss
  70. 27
      frontend/src/app/framework/angular/forms/progress-bar.component.ts
  71. 2
      frontend/src/app/framework/angular/list-view.component.scss
  72. 5
      frontend/src/app/framework/angular/modals/tour-template.component.scss
  73. 3
      frontend/src/app/framework/angular/video-player.component.scss
  74. 1
      frontend/src/app/framework/internal.ts
  75. 140
      frontend/src/app/framework/services/theme.service.spec.ts
  76. 82
      frontend/src/app/framework/services/theme.service.ts
  77. 2
      frontend/src/app/shared/components/app-form.component.scss
  78. 2
      frontend/src/app/shared/components/assets/asset-selector.component.scss
  79. 2
      frontend/src/app/shared/components/assets/asset.component.scss
  80. 4
      frontend/src/app/shared/components/assets/assets-list.component.scss
  81. 18
      frontend/src/app/shared/components/cards/iframe-card.component.ts
  82. 23
      frontend/src/app/shared/components/cards/shared.ts
  83. 6
      frontend/src/app/shared/components/chat-item.component.scss
  84. 2
      frontend/src/app/shared/components/comments/comment.component.scss
  85. 2
      frontend/src/app/shared/components/comments/comments.component.scss
  86. 4
      frontend/src/app/shared/components/contents/content-value.component.scss
  87. 19
      frontend/src/app/shared/components/forms/rich-editor.component.ts
  88. 3
      frontend/src/app/shared/components/notifo.component.scss
  89. 2
      frontend/src/app/shared/components/schema-category.component.scss
  90. 2
      frontend/src/app/shared/components/search/search-form.component.scss
  91. 10
      frontend/src/app/shared/components/tour-guide.component.scss
  92. 2
      frontend/src/app/shared/components/watching-users.component.scss
  93. 2
      frontend/src/app/shell/pages/internal/apps-menu.component.scss
  94. 2
      frontend/src/app/shell/pages/internal/internal-area.component.html
  95. 3
      frontend/src/app/shell/pages/internal/internal-area.component.scss
  96. 14
      frontend/src/app/shell/pages/internal/profile-menu.component.html
  97. 25
      frontend/src/app/shell/pages/internal/profile-menu.component.ts
  98. 28
      frontend/src/app/theme/_bootstrap-vars.scss
  99. 72
      frontend/src/app/theme/_bootstrap.scss
  100. 277
      frontend/src/app/theme/_colors.scss

19
.github/workflows/dev.yml

@ -114,6 +114,7 @@ jobs:
working-directory: './tools/e2e'
- name: Run Playwright Tests
id: playwright
run: npx playwright test --retries=3
working-directory: './tools/e2e'
env:
@ -126,7 +127,23 @@ jobs:
name: playwright-report
path: tools/e2e/playwright-report/
retention-days: 30
- name: Update Playwright Snapshots
if: failure() && steps.playwright.outcome == 'failure'
continue-on-error: true
run: npx playwright test --update-snapshots --reporter=list
working-directory: './tools/e2e'
env:
BASE__URL: http://localhost:8080
- name: Upload Playwright Snapshots
if: failure() && steps.playwright.outcome == 'failure'
uses: actions/upload-artifact@v4.6.2
with:
name: playwright-snapshots
path: tools/e2e/snapshots/
retention-days: 30
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2.2.2

1
CLAUDE.md

@ -28,6 +28,7 @@ npm run lint
- i18n texts live in `backend/i18n`, translations are generated into the frontend — do not edit generated translation files by hand.
- Do not write JsDoc comments.
- Define colors only in `src/app/theme/_colors.scss`: literal values, the light/dark palettes and computed colors (`shade()`, `fade()`, ...). Everywhere else use the `$color-*` variables. In TypeScript, read theme colors with `ThemeService.getColor()`. Exceptions are semantic data colors (avatar colors, rule icon colors, chart colors).
- In tests, keep `verify` calls and `expect` calls next to each other, without blank lines between them.
## Backend

6
backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentFlowStep.cs

@ -98,12 +98,12 @@ public sealed record CreateContentFlowStep : FlowStep, IConvertibleToAction
ContentDataCommand command;
if (!string.IsNullOrWhiteSpace(Id))
{
command = new UpsertCommand
{
command = new UpsertCommand
{
ContentId = DomainId.Create(Id.Trim()),
EnrichDefaults = true,
EnrichRequiredFields = false,
Patch = Patch,
Patch = Patch,
Status = status
};
}

4
backend/i18n/frontend_de.json

@ -419,6 +419,10 @@
"common.tagsAll": "Alle Tags",
"common.teams": "Teams",
"common.templates": "Vorlagen",
"common.theme": "Design",
"common.themeDark": "Dunkel",
"common.themeLight": "Hell",
"common.themeSystem": "System",
"common.time": "Zeit",
"common.to": "Bis",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/frontend_en.json

@ -419,6 +419,10 @@
"common.tagsAll": "All tags",
"common.teams": "Teams",
"common.templates": "Templates",
"common.theme": "Theme",
"common.themeDark": "Dark",
"common.themeLight": "Light",
"common.themeSystem": "System",
"common.time": "Time",
"common.to": "To",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/frontend_fr.json

@ -419,6 +419,10 @@
"common.tagsAll": "Toutes les balises",
"common.teams": "Équipes",
"common.templates": "Modèles",
"common.theme": "Thème",
"common.themeDark": "Sombre",
"common.themeLight": "Clair",
"common.themeSystem": "Système",
"common.time": "Temps",
"common.to": "Pour",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/frontend_it.json

@ -419,6 +419,10 @@
"common.tagsAll": "Tutti i tag",
"common.teams": "Teams",
"common.templates": "Templates",
"common.theme": "Tema",
"common.themeDark": "Scuro",
"common.themeLight": "Chiaro",
"common.themeSystem": "Sistema",
"common.time": "Ora",
"common.to": "To",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/frontend_nl.json

@ -419,6 +419,10 @@
"common.tagsAll": "Alle tags",
"common.teams": "Teams",
"common.templates": "Templates",
"common.theme": "Thema",
"common.themeDark": "Donker",
"common.themeLight": "Licht",
"common.themeSystem": "Systeem",
"common.time": "Tijd",
"common.to": "Naar",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/frontend_pt.json

@ -419,6 +419,10 @@
"common.tagsAll": "Todas as etiquetas",
"common.teams": "Equipas",
"common.templates": "Modelos",
"common.theme": "Tema",
"common.themeDark": "Escuro",
"common.themeLight": "Claro",
"common.themeSystem": "Sistema",
"common.time": "Hora",
"common.to": "Para",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/frontend_zh.json

@ -419,6 +419,10 @@
"common.tagsAll": "所有标签",
"common.teams": "Teams",
"common.templates": "Templates",
"common.theme": "主题",
"common.themeDark": "深色",
"common.themeLight": "浅色",
"common.themeSystem": "跟随系统",
"common.time": "时间",
"common.to": "To",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/source/frontend_de.json

@ -400,6 +400,10 @@
"common.tagsAll": "Alle Tags",
"common.teams": "Teams",
"common.templates": "Vorlagen",
"common.theme": "Design",
"common.themeDark": "Dunkel",
"common.themeLight": "Hell",
"common.themeSystem": "System",
"common.time": "Zeit",
"common.to": "Bis",
"common.update": "Aktualisieren",

4
backend/i18n/source/frontend_en.json

@ -419,6 +419,10 @@
"common.tagsAll": "All tags",
"common.teams": "Teams",
"common.templates": "Templates",
"common.theme": "Theme",
"common.themeDark": "Dark",
"common.themeLight": "Light",
"common.themeSystem": "System",
"common.time": "Time",
"common.to": "To",
"common.togglePanel": "Toggle panel size",

4
backend/i18n/source/frontend_fr.json

@ -355,6 +355,10 @@
"common.tagsAll": "Toutes les balises",
"common.teams": "Équipes",
"common.templates": "Modèles",
"common.theme": "Thème",
"common.themeDark": "Sombre",
"common.themeLight": "Clair",
"common.themeSystem": "Système",
"common.time": "Temps",
"common.to": "Pour",
"common.update": "Mise à jour",

4
backend/i18n/source/frontend_it.json

@ -276,6 +276,10 @@
"common.tagAddSchema": ", aggiungi schema",
"common.tags": "Tag",
"common.tagsAll": "Tutti i tag",
"common.theme": "Tema",
"common.themeDark": "Scuro",
"common.themeLight": "Chiaro",
"common.themeSystem": "Sistema",
"common.time": "Ora",
"common.update": "Aggiorna",
"common.upload": "Carica",

4
backend/i18n/source/frontend_nl.json

@ -327,6 +327,10 @@
"common.tagAddSchema": ", om schema toe te voegen",
"common.tags": "Tags",
"common.tagsAll": "Alle tags",
"common.theme": "Thema",
"common.themeDark": "Donker",
"common.themeLight": "Licht",
"common.themeSystem": "Systeem",
"common.time": "Tijd",
"common.to": "Naar",
"common.update": "Update",

4
backend/i18n/source/frontend_pt.json

@ -348,6 +348,10 @@
"common.tagsAll": "Todas as etiquetas",
"common.teams": "Equipas",
"common.templates": "Modelos",
"common.theme": "Tema",
"common.themeDark": "Escuro",
"common.themeLight": "Claro",
"common.themeSystem": "Sistema",
"common.time": "Hora",
"common.to": "Para",
"common.update": "Atualização",

4
backend/i18n/source/frontend_zh.json

@ -295,6 +295,10 @@
"common.tagAddSchema": ", 添加Schemas",
"common.tags": "标签",
"common.tagsAll": "所有标签",
"common.theme": "主题",
"common.themeDark": "深色",
"common.themeLight": "浅色",
"common.themeSystem": "跟随系统",
"common.time": "时间",
"common.update": "更新",
"common.upload": "上传",

6
backend/src/Squidex.Domain.Apps.Entities/Backup/BackupJob.cs

@ -69,7 +69,10 @@ public sealed class BackupJob(
var appName = context.TryGetArgument(ArgAppName) ?? "app";
// We store the file in a the asset store and make the information available.
context.Job.File = new JobFile($"backup-{appName}-{context.Job.Started:yyyy-MM-dd_HH-mm-ss}.zip", "application/zip");
context.Job.File =
new JobFile(
$"backup-{appName}-{context.Job.Started:yyyy-MM-dd_HH-mm-ss}.zip",
"application/zip");
// Use a readable name to describe the job.
context.Job.Description = T.Get("jobs.backup");
@ -77,7 +80,6 @@ public sealed class BackupJob(
var handlers = backupHandlerFactory.CreateMany();
await using var stream = backupArchiveLocation.OpenStream(context.Job.Id);
using (var writer = await backupArchiveLocation.OpenWriterAsync(stream, ct))
{
await writer.WriteVersionAsync();

2
backend/src/Squidex.Domain.Apps.Entities/Jobs/JobProcessor.cs

@ -84,14 +84,12 @@ public sealed class JobProcessor
LogMessages.LogClearingJobs(log, ownerId);
var job = state.Value.Jobs.Find(x => x.Id == jobId);
if (job == null)
{
return;
}
var runner = runners.FirstOrDefault(x => x.Name == job.TaskName);
if (runner != null)
{
await runner.CleanupAsync(job);

73
backend/src/Squidex/Areas/Api/Views/Shared/Docs.cshtml

@ -17,6 +17,12 @@
<style>
body { margin: 0; padding: 0; }
html[data-bs-theme='dark'] body { background: #16181c; }
/* Some labels of redoc use hardcoded colors. */
html[data-bs-theme='dark'] #redoc-container h5,
html[data-bs-theme='dark'] #redoc-container h5 span { color: #a9afb9; }
.menu-content {
position: fixed !important;
}
@ -35,10 +41,75 @@
<body>
<div id="redoc-container"></div>
<script>
// Apply the color scheme before the page is rendered to avoid flickering. See ThemeService.
var themeDark = false;
try {
var themeMode = localStorage.getItem("squidex.theme");
themeDark = themeMode === "dark" || (themeMode !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
document.documentElement.setAttribute("data-bs-theme", themeDark ? "dark" : "light");
} catch { }
</script>
<script src="~/scripts/redoc.standalone.js"></script>
<script>
// Redoc has its own theme and does not use the stylesheet of the app.
var themeDarkColors = {
colors: {
primary: {
main: '#3f83df'
},
text: {
primary: '#d6d9de',
secondary: '#a9afb9'
},
border: {
dark: '#363a42',
light: '#2e3238'
},
gray: {
50: '#1f2227',
100: '#2e3238'
}
},
sidebar: {
backgroundColor: '#1f2227',
textColor: '#d6d9de',
activeTextColor: '#75aeff'
},
rightPanel: {
backgroundColor: '#101216'
},
schema: {
nestedBackground: '#1f2227',
typeNameColor: '#a9afb9',
typeTitleColor: '#d6d9de'
},
responses: {
success: {
color: '#5fd08a',
backgroundColor: '#173a28'
},
error: {
color: '#f38a96',
backgroundColor: '#43202a'
},
redirect: {
color: '#f0b35a',
backgroundColor: '#3d2e14'
},
info: {
color: '#5dcde6',
backgroundColor: '#113a45'
}
}
};
Redoc.init('@Url.Content(Model.Specification)', {
theme: {
theme: themeDark ? themeDarkColors : {
colors: {
primary: {
main: '#3f83df'

13
backend/src/Squidex/Areas/IdentityServer/Views/_Layout.cshtml

@ -8,6 +8,16 @@
<title>@ViewBag.Title - @T.Get("common.product")</title>
<script>
// Apply the color scheme before the page is rendered to avoid flickering. See ThemeService.
try {
var themeMode = localStorage.getItem("squidex.theme");
var themeDark = themeMode === "dark" || (themeMode !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
document.documentElement.setAttribute("data-bs-theme", themeDark ? "dark" : "light");
} catch { }
</script>
<link rel="stylesheet" href="styles.css" asp-append-version="true" />
@if (IsSectionDefined("header"))
@ -22,7 +32,8 @@
</head>
<body class="profile">
<div class="profile-container">
<img class="profile-logo" alt="@T.Get("common.product")" title="@T.Get("common.product")" src="images/logo.svg" />
<img class="profile-logo profile-logo-light" alt="@T.Get("common.product")" title="@T.Get("common.product")" src="images/logo.svg" />
<img class="profile-logo profile-logo-dark" alt="@T.Get("common.product")" title="@T.Get("common.product")" src="images/logo-white.png" />
<div class="profile-card card">
<div class="profile-card-body card-body">

381
backend/src/Squidex/wwwroot/editor/squidex-editor.js

File diff suppressed because one or more lines are too long

108
backend/src/Squidex/wwwroot/images/dashboard-api.svg

@ -1,12 +1,98 @@
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" x="0" y="0" version="1.1" xml:space="preserve" viewBox="0 0 57 62">
<path id="path38" fill="#f2bdbd" stroke="#2e3842" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M38.2 53H18.8C12.9 53 8 48.1 8 42.2V11.8C8 5.9 12.9 1 18.8 1h25.1C46.7 1 49 3.3 49 6.1v36.1C49 48.1 44.1 53 38.2 53z"/>
<path id="path40" fill="none" stroke="#f7dcdc" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M38.1 53H18.9C14 53 10 49 10 44.1V11.9C10 7 14 3 18.9 3h24.9c1.8 0 3.3 1.5 3.3 3.3v37.9C47 49 43 53 38.1 53z"/>
<path id="line90" fill="none" stroke="#e29393" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M17.1 13H40" class="st13"/>
<path id="line92" fill="none" stroke="#e29393" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M17.1 20H40" class="st13"/>
<path id="line94" fill="none" stroke="#e29393" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M17.1 27H26" class="st13"/>
<g id="g100" transform="translate(-364 -444)">
<path id="path96" fill="#fff" d="M369 484h12.3c1.6 0 3.1 1 3.7 2.5.6 1.5 2.1 2.5 3.7 2.5H416c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-47c-2.2 0-4-1.8-4-4v-13c0-2.2 1.8-4 4-4z"/>
<path id="path98" fill="#2e3842" d="M366 495v-7c0-1.6 1.3-3 3-3h12.3c1.2 0 2.3.7 2.8 1.9.8 1.9 2.6 3.1 4.6 3.1H416c1.6 0 3 1.3 3 3v4h2v-4c0-2.7-2.2-5-5-5h-27.3c-1.2 0-2.3-.7-2.8-1.9-.8-1.9-2.6-3.1-4.6-3.1H369c-2.7 0-5 2.2-5 5v7z"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
id="Layer_1"
x="0"
y="0"
version="1.1"
xml:space="preserve"
viewBox="0 0 57 62"
sodipodi:docname="dashboard-api.svg"
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs1" /><sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="14"
inkscape:cx="28.464286"
inkscape:cy="38.714286"
inkscape:window-width="1920"
inkscape:window-height="1112"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" />
<path
id="path38"
fill="#f2bdbd"
stroke="#2e3842"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M38.2 53H18.8C12.9 53 8 48.1 8 42.2V11.8C8 5.9 12.9 1 18.8 1h25.1C46.7 1 49 3.3 49 6.1v36.1C49 48.1 44.1 53 38.2 53z" />
<path
id="path40"
fill="none"
stroke="#f7dcdc"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M38.1 53H18.9C14 53 10 49 10 44.1V11.9C10 7 14 3 18.9 3h24.9c1.8 0 3.3 1.5 3.3 3.3v37.9C47 49 43 53 38.1 53z" />
<path
id="line90"
fill="none"
stroke="#e29393"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M17.1 13H40"
class="st13" />
<path
id="line92"
fill="none"
stroke="#e29393"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M17.1 20H40"
class="st13" />
<path
id="line94"
fill="none"
stroke="#e29393"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M17.1 27H26"
class="st13" />
<g
id="g100"
transform="translate(-364 -444)">
<path
id="path96"
fill="#fff"
d="M369 484h12.3c1.6 0 3.1 1 3.7 2.5.6 1.5 2.1 2.5 3.7 2.5H416c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-47c-2.2 0-4-1.8-4-4v-13c0-2.2 1.8-4 4-4z" />
<path
id="path98"
fill="#2e3842"
d="m 366,495 v -7 c 0,-1.6 1.3,-3 3,-3 h 12.3 c 1.2,0 2.3,0.7 2.8,1.9 0.8,1.9 2.6,3.1 4.6,3.1 H 416 c 1.6,0 3,1.3 3,3 v 6 h 2 v -6 c 0,-2.7 -2.2,-5 -5,-5 h -27.3 c -1.2,0 -2.3,-0.7 -2.8,-1.9 -0.8,-1.9 -2.6,-3.1 -4.6,-3.1 H 369 c -2.7,0 -5,2.2 -5,5 v 7 z"
sodipodi:nodetypes="cssscsssccssscssscc" />
</g>
<path id="path102" fill="#b4bcc1" d="M55 57c0 1.6-1.3 3-3 3H5c-1.6 0-3-1.3-3-3v-4H0v4c0 2.7 2.2 5 5 5h47c2.7 0 5-2.2 5-5z"/>
</svg>
<path
id="path102"
fill="#b4bcc1"
d="M55 57c0 1.6-1.3 3-3 3H5c-1.6 0-3-1.3-3-3v-4H0v4c0 2.7 2.2 5 5 5h47c2.7 0 5-2.2 5-5z" />
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

119
backend/src/Squidex/wwwroot/images/dashboard-feedback.svg

@ -1,16 +1,103 @@
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" x="0" y="0" version="1.1" xml:space="preserve" viewBox="0 0 54.1 62">
<path id="path16" fill="#f7f6e7" d="M43.5 31.5s-2 10-18 16l11 7v-7l4.7.1 2.3-1.1 1-3z"/>
<path id="path134" fill="#efebbf" stroke="#2e3842" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M49.7 1H12.5C7.3 1 3 5.3 3 10.5v13.3C3 26.7 5.3 29 8.2 29H15v6l5.3-3.7c2.1-1.5 4.7-2.3 7.3-2.3h16c5.2 0 9.5-4.3 9.5-9.5V4.3C53 2.5 51.5 1 49.7 1z"/>
<g id="g140" transform="translate(-461 -444)">
<g id="g138">
<path id="path136" fill="#fcfbeb" d="M509.8 448c.7 0 1.2.5 1.2 1.1v13.8c0 3.7-3.2 6.6-7.1 6.6h-15.3c-2.9 0-5.7.8-8.1 2.4l-2 1.3v-1.7c0-1.1-.9-2-2-2H470c-1.7 0-3-1.2-3-2.8v-12.1c0-3.7 3.2-6.6 7.1-6.6h35.7m0-2h-35.7c-5 0-9.1 3.9-9.1 8.6v12.1c0 2.6 2.3 4.8 5 4.8h6.5v5.5l5.1-3.4c2-1.4 4.5-2.1 7-2.1h15.3c5 0 9.1-3.9 9.1-8.6v-13.8c0-1.7-1.4-3.1-3.2-3.1z"/>
</g>
</g>
<path id="line142" fill="none" stroke="#cec395" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M13.5 10h29" class="st22"/>
<path id="line144" fill="none" stroke="#cec395" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M13 16h18" class="st22"/>
<circle id="circle146" cx="11.5" cy="50.5" r="11.5" fill="#f9c553"/>
<circle id="circle148" cx="15.1" cy="48.1" r="1.5" fill="#fff" class="st14"/>
<circle id="circle150" cx="8" cy="48" r="1.5" fill="#fff" class="st14"/>
<path id="path152" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" d="M6 53s6 5 12 0"/>
<path id="path154" fill="#b4bcc1" d="M43 32v11.8c0 2.3-1.9 4.2-4.2 4.2H36c-.6 0-1 .4-1 1v4.1l-3.7-2.6c-1.9-1.3-4-2.1-6.3-2.4v2c1.8.2 3.6.9 5.1 2l5.3 3.7c.2.1.4.2.6.2.2 0 .3 0 .5-.1.3-.2.5-.5.5-.9v-5h1.8c3.4 0 6.2-2.8 6.2-6.2V32z"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
id="Layer_1"
x="0"
y="0"
version="1.1"
xml:space="preserve"
viewBox="0 0 54.1 62"
sodipodi:docname="dashboard-feedback.svg"
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs1" /><sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="19.79899"
inkscape:cx="17.147339"
inkscape:cy="20.85965"
inkscape:window-width="1920"
inkscape:window-height="1112"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" />
<path
id="path134"
fill="#efebbf"
stroke="#2e3842"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M49.7 1H12.5C7.3 1 3 5.3 3 10.5v13.3C3 26.7 5.3 29 8.2 29H15v6l5.3-3.7c2.1-1.5 4.7-2.3 7.3-2.3h16c5.2 0 9.5-4.3 9.5-9.5V4.3C53 2.5 51.5 1 49.7 1z" /><path
id="path134-1"
fill="none"
stroke="#fcfbeb"
stroke-linecap="round"
stroke-linejoin="miter"
stroke-miterlimit="10"
stroke-width="2"
d="M49.7 3H12.5C8.36 3 5 6.36 5 10.5V23.8C5 25.57 6.43 27 8.2 27H15a2 2 0 0 1 2 2v2.16l2.16-1.5C21.6 27.95 24.59 27 27.6 27H43.6C47.74 27 51 23.64 51 19.5V4.3C51 3.58 50.42 3 49.7 3Z" />
<path
id="line142"
fill="none"
stroke="#cec395"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M13.5 10h29"
class="st22" />
<path
id="line144"
fill="none"
stroke="#cec395"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="M13 16h18"
class="st22" />
<circle
id="circle146"
cx="11.5"
cy="50.5"
r="11.5"
fill="#f9c553" />
<g
id="g1"
transform="translate(-0.05000019)"><circle
id="circle148"
cx="15.1"
cy="48.099998"
r="1.5"
fill="#ffffff"
class="st14" /><circle
id="circle150"
cx="8"
cy="48"
r="1.5"
fill="#ffffff"
class="st14" /></g>
<path
id="path152"
fill="none"
stroke="#ffffff"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="2"
d="m 5.5,53 c 0,0 6,5 12,0" />
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

38
backend/src/Squidex/wwwroot/scripts/editor-sdk.d.ts

@ -5,6 +5,8 @@ type PluginOptions = {
acceptedOrigins?: string[];
}
type SquidexTheme = 'light' | 'dark';
declare class SquidexSidebar {
/**
* The constructor.
@ -37,6 +39,18 @@ declare class SquidexSidebar {
*/
onContentChanged(callback: (content: any) => void): void;
/**
* Get the current theme of the Squidex UI ('light' or 'dark').
*/
getTheme(): SquidexTheme | undefined;
/**
* Register an function that is called whenever the theme of the Squidex UI has changed.
*
* @param callback: The callback to invoke. Argument 1: Theme ('light' or 'dark').
*/
onThemeChanged(callback: (theme: SquidexTheme) => void): void;
/**
* Clean the editor SDK.
*/
@ -63,6 +77,18 @@ declare class SquidexWidget {
*/
onInit(callback: () => void): void;
/**
* Get the current theme of the Squidex UI ('light' or 'dark').
*/
getTheme(): SquidexTheme | undefined;
/**
* Register an function that is called whenever the theme of the Squidex UI has changed.
*
* @param callback: The callback to invoke. Argument 1: Theme ('light' or 'dark').
*/
onThemeChanged(callback: (theme: SquidexTheme) => void): void;
/**
* Clean the editor SDK.
*/
@ -247,6 +273,18 @@ declare class SquidexFormField {
*/
onExpanded(callback: (isExpanded: boolean) => void): void;
/**
* Get the current theme of the Squidex UI ('light' or 'dark').
*/
getTheme(): SquidexTheme | undefined;
/**
* Register an function that is called whenever the theme of the Squidex UI has changed.
*
* @param callback: The callback to invoke. Argument 1: Theme ('light' or 'dark').
*/
onThemeChanged(callback: (theme: SquidexTheme) => void): void;
/**
* Clean the editor SDK.
*/

111
backend/src/Squidex/wwwroot/scripts/editor-sdk.js

@ -27,6 +27,13 @@ function measureAndNotifyParent() {
}, 50);
}
function applyTheme(theme) {
// Plugins that use the Squidex stylesheet or bootstrap are switched to the same color scheme automatically.
if (isString(theme)) {
document.documentElement.setAttribute('data-bs-theme', theme);
}
}
function isNumber(value) {
return typeof value === 'number';
}
@ -64,6 +71,8 @@ function SquidexSidebar(options) {
var contentHandler;
var content;
var context;
var theme;
var themeHandler;
var timer;
var acceptedOrigins = options && isArrayOfStrings(options.acceptedOrigins) ? options.acceptedOrigins : null;
@ -73,6 +82,12 @@ function SquidexSidebar(options) {
}
}
function raiseThemeChanged() {
if (themeHandler && isString(theme)) {
themeHandler(theme);
}
}
function raiseInit() {
if (initHandler && !initCalled && context) {
initHandler(context);
@ -96,6 +111,11 @@ function SquidexSidebar(options) {
content = event.data.content;
raiseContentChanged();
} else if (type === 'themeChanged') {
theme = event.data.theme;
applyTheme(theme);
raiseThemeChanged();
} else if (type === 'init') {
context = event.data.context;
@ -156,6 +176,28 @@ function SquidexSidebar(options) {
raiseContentChanged();
},
/**
* Get the current theme of the Squidex UI ('light' or 'dark').
*/
getTheme: function () {
return theme;
},
/**
* Register an function that is called whenever the theme of the Squidex UI has changed.
*
* @param {function} callback: The callback to invoke. Argument 1: Theme ('light' or 'dark').
*/
onThemeChanged: function (callback) {
if (!isFunction(callback)) {
return;
}
themeHandler = callback;
raiseThemeChanged();
},
/**
* Clean the editor SDK.
*/
@ -183,6 +225,8 @@ function SquidexWidget(options) {
var initHandler;
var initCalled = false;
var context;
var theme;
var themeHandler;
var acceptedOrigins = options && isArrayOfStrings(options.acceptedOrigins) ? options.acceptedOrigins : null;
document.body.style.margin = '0';
@ -195,6 +239,12 @@ function SquidexWidget(options) {
}
}
function raiseThemeChanged() {
if (themeHandler && isString(theme)) {
themeHandler(theme);
}
}
function eventListener(event) {
if (acceptedOrigins && acceptedOrigins.indexOf(event.origin) < 0) {
console.log('Origin not accepted: ' + event.origin);
@ -211,6 +261,11 @@ function SquidexWidget(options) {
context = event.data.context;
raiseInit();
} else if (type === 'themeChanged') {
theme = event.data.theme;
applyTheme(theme);
raiseThemeChanged();
}
console.log('Received Message: ' + type);
@ -241,6 +296,28 @@ function SquidexWidget(options) {
raiseInit();
},
/**
* Get the current theme of the Squidex UI ('light' or 'dark').
*/
getTheme: function () {
return theme;
},
/**
* Register an function that is called whenever the theme of the Squidex UI has changed.
*
* @param {function} callback: The callback to invoke. Argument 1: Theme ('light' or 'dark').
*/
onThemeChanged: function (callback) {
if (!isFunction(callback)) {
return;
}
themeHandler = callback;
raiseThemeChanged();
},
/**
* Clean the editor SDK.
*/
@ -277,6 +354,8 @@ function SquidexFormField(options) {
var language;
var languageHandler;
var movedHandler;
var theme;
var themeHandler;
var timer;
var value;
var valueHandler;
@ -337,6 +416,12 @@ function SquidexFormField(options) {
}
}
function raiseThemeChanged() {
if (themeHandler && isString(theme)) {
themeHandler(theme);
}
}
function eventListener(event) {
if (acceptedOrigins && acceptedOrigins.indexOf(event.origin) < 0) {
console.log('Origin not accepted: ' + event.origin);
@ -397,6 +482,11 @@ function SquidexFormField(options) {
context = event.data.context;
raiseContextChanged();
} else if (type === 'themeChanged') {
theme = event.data.theme;
applyTheme(theme);
raiseThemeChanged();
} else if (type === 'confirmResult') {
var correlationId = event.data.correlationId;
@ -487,6 +577,13 @@ function SquidexFormField(options) {
return expanded;
},
/**
* Get the current theme of the Squidex UI ('light' or 'dark').
*/
getTheme: function () {
return theme;
},
/**
* Notifies the control container that the editor has been touched.
*/
@ -758,6 +855,20 @@ function SquidexFormField(options) {
raiseExpanded();
},
/**
* Register an function that is called whenever the theme of the Squidex UI has changed.
*
* @param {function} callback: The callback to invoke. Argument 1: Theme ('light' or 'dark').
*/
onThemeChanged: function (callback) {
if (!isFunction(callback)) {
return;
}
themeHandler = callback;
raiseThemeChanged();
},
/**
* Clean the editor SDK.
*/

3
frontend/src/app/app.component.ts

@ -8,7 +8,7 @@
import { Component, Injector } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { AnalyticsService, CopyGlobalDirective, DialogRendererComponent, RootViewComponent, TourGuideComponent, TourTemplateComponent, TranslatePipe } from '@app/shared';
import { AnalyticsService, CopyGlobalDirective, DialogRendererComponent, RootViewComponent, syncChartTheme, ThemeService, TourGuideComponent, TourTemplateComponent, TranslatePipe } from '@app/shared';
@Component({
selector: 'sqx-app',
@ -29,5 +29,6 @@ export class AppComponent {
constructor(injector: Injector) {
injector.get(AnalyticsService);
syncChartTheme(injector.get(ThemeService));
}
}

9
frontend/src/app/declarations.d.ts

@ -90,6 +90,15 @@ interface EditorProps {
// The class names.
classNames?: ReadonlyArray<string>;
// The background color of the toolbar and the menus. The text color is derived from it.
baseColor?: string;
// The color for active and selected elements.
accentColor?: string;
// The color for all borders.
borderColor?: string;
// Called when the value has been changed.
onChange?: OnChange;

2
frontend/src/app/features/administration/pages/event-consumers/event-consumers-page.component.scss

@ -6,7 +6,7 @@
color: $color-theme-error;
&-icon {
@include build-icon($color-theme-error);
@include build-icon($color-theme-error, $color-theme-error-contrast-10);
}
}

15
frontend/src/app/features/api/pages/graphql/graphql-page.component.scss

@ -5,6 +5,17 @@
@return unquote('#{hue($color)}, #{saturation($color)}, #{lightness($color)}');
}
:host-context([data-bs-theme='dark']) ::ng-deep {
// GraphiQL has its own dark colors, which have a higher specificity.
.graphiql-container {
--color-primary: #{hsl-str($color-theme-brand)};
--color-success: #{hsl-str($color-theme-success)};
--color-error: #{hsl-str($color-theme-error)};
--color-neutral: #{hsl-str($color-raw-dark-text)};
--color-base: #{hsl-str($color-raw-dark-surface)};
}
}
:host ::ng-deep {
.graphiql-container {
@include absolute(0, 0, 0, 0);
@ -12,7 +23,7 @@
--color-primary: #{hsl-str($color-theme-brand)};
--color-success: #{hsl-str($color-theme-success)};
--color-error: #{hsl-str($color-theme-error)};
--color-neutral: #{hsl-str($color-text)};
--color-neutral: #{hsl-str($color-raw-light-text)};
--border-radius-4: #{$border-radius};
--border-radius-8: #{$border-radius};
--border-radius-12: #{$border-radius};
@ -34,6 +45,6 @@
width: 44px;
&:hover {
background: rgba(59, 75, 104, 7%);
background: $color-graphql-hover;
}
}

25
frontend/src/app/features/api/pages/graphql/graphql-page.component.ts

@ -12,7 +12,7 @@ import { createGraphiQLFetcher } from '@graphiql/toolkit';
import { GraphiQL } from 'graphiql';
import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
import { ApiUrlConfig, AppsState, AuthService, ClientDto, ClientsService, ClientsState, DialogModel, FormHintComponent, FormRowComponent, LayoutComponent, MessageBus, ModalDialogComponent, ModalDirective, QueryExecuted, TitleComponent, TooltipDirective, TourStepDirective, TranslatePipe, Types } from '@app/shared';
import { ApiUrlConfig, AppsState, AuthService, ClientDto, ClientsService, ClientsState, DialogModel, FormHintComponent, FormRowComponent, LayoutComponent, MessageBus, ModalDialogComponent, ModalDirective, QueryExecuted, Subscriptions, ThemeService, TitleComponent, TooltipDirective, TourStepDirective, TranslatePipe, Types } from '@app/shared';
@Component({
selector: 'sqx-graphql-page',
@ -38,6 +38,9 @@ export class GraphQLPageComponent implements AfterViewInit, OnInit, OnDestroy {
@ViewChild('graphiQLContainer', { static: false })
public graphiQLContainer!: ElementRef;
private readonly subscriptions = new Subscriptions();
private fetcher?: ReturnType<typeof createGraphiQLFetcher>;
public clientsReadable = false;
public clientsDialog = new DialogModel();
public clientSelected: ClientDto | null = null;
@ -48,6 +51,7 @@ export class GraphQLPageComponent implements AfterViewInit, OnInit, OnDestroy {
private readonly authService: AuthService,
private readonly clientsService: ClientsService,
private readonly messageBus: MessageBus,
private readonly themeService: ThemeService,
public readonly clientsState: ClientsState,
) {
}
@ -68,6 +72,12 @@ export class GraphQLPageComponent implements AfterViewInit, OnInit, OnDestroy {
public ngAfterViewInit() {
this.reactRoot = ReactDOM.createRoot(this.graphiQLContainer.nativeElement);
this.selectClient(null);
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.render();
}));
}
public selectClient(client: ClientDto | null) {
@ -94,7 +104,7 @@ export class GraphQLPageComponent implements AfterViewInit, OnInit, OnDestroy {
.replace('https://', 'wss://') +
`?access_token=${accessToken}`;
const fetcher = createGraphiQLFetcher({
this.fetcher = createGraphiQLFetcher({
url: graphQLEndpoint,
headers: {
Authorization: `Bearer ${accessToken}`,
@ -111,9 +121,18 @@ export class GraphQLPageComponent implements AfterViewInit, OnInit, OnDestroy {
subscriptionUrl,
});
this.render();
}
private render() {
if (!this.fetcher) {
return;
}
this.reactRoot?.render(
React.createElement(GraphiQL, {
fetcher,
fetcher: this.fetcher,
forcedTheme: this.themeService.theme,
}),
);
}

2
frontend/src/app/features/apps/pages/app.component.scss

@ -71,7 +71,7 @@
}
&:hover {
@include box-shadow-outer(0, 3px, 16px, .2);
@include box-shadow-outer(0, 3px, 16px, $color-shadow-20);
}
}
}

2
frontend/src/app/features/apps/pages/news-dialog.component.scss

@ -3,7 +3,7 @@
:host ::ng-deep {
img {
@include box-shadow-outer(0, 4px, 20px, .2);
@include box-shadow-outer(0, 4px, 20px, $color-shadow-20);
display: block;
margin: 10px auto;
max-width: 80%;

2
frontend/src/app/features/apps/pages/onboarding-dialog.component.scss

@ -72,7 +72,7 @@ h2 {
@include absolute(0, null, null, 50%);
@include circle($size-squid);
border: 1px solid $color-border;
background: $color-white;
background: $color-surface;
margin-left: -$size-squid * .5;
margin-top: -$size-squid * .5;

4
frontend/src/app/features/content/pages/content/content-page.component.scss

@ -13,7 +13,7 @@
@include absolute(null, null, -.6125rem, 0);
@include force-width(1.25rem);
@include force-height(1.25rem);
background-color: $color-white;
background-color: $color-surface;
line-height: 1;
padding: 0;
text-align: center;
@ -33,7 +33,7 @@
.menu {
@include absolute(0, 0, 0);
align-items: center;
background: white;
background: $color-surface;
border-radius: 0;
border: 0;
display: flex;

4
frontend/src/app/features/content/pages/contents/contents-page.component.scss

@ -10,7 +10,7 @@
}
.table-items {
background-color: $color-white;
background-color: $color-surface;
th {
border-left: 1px solid $color-border;
@ -76,7 +76,7 @@
}
.btn-status {
background: $color-white;
background: $color-surface;
}
.selection {

15
frontend/src/app/features/content/shared/content-extension.component.ts

@ -7,7 +7,7 @@
import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, HostListener, Input, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { ApiUrlConfig, AppsState, AuthService, computeEditorUrl, ContentDto, SafeResourceUrlPipe, SchemaDto, TypedSimpleChanges, Types } from '@app/shared';
import { ApiUrlConfig, AppsState, AuthService, computeEditorUrl, ContentDto, SafeResourceUrlPipe, SchemaDto, Subscriptions, ThemeService, TypedSimpleChanges, Types } from '@app/shared';
@Component({
selector: 'sqx-content-extension',
@ -19,6 +19,7 @@ import { ApiUrlConfig, AppsState, AuthService, computeEditorUrl, ContentDto, Saf
],
})
export class ContentExtensionComponent {
private readonly subscriptions = new Subscriptions();
private readonly context: any;
private isInitialized = false;
@ -44,7 +45,14 @@ export class ContentExtensionComponent {
constructor(apiUrl: ApiUrlConfig, authService: AuthService,
private readonly appsState: AppsState,
private readonly router: Router,
private readonly themeService: ThemeService,
) {
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.sendTheme();
}));
this.context = {
apiUrl: apiUrl.buildUrl('api'),
appId: appsState.snapshot.selectedApp!.id,
@ -72,6 +80,7 @@ export class ContentExtensionComponent {
if (type === 'started') {
this.isInitialized = true;
this.sendTheme();
this.sendInit();
this.sendContent();
} else if (type === 'resize' && !this.scrollable) {
@ -90,6 +99,10 @@ export class ContentExtensionComponent {
this.sendMessage('init', { context: this.context });
}
private sendTheme() {
this.sendMessage('themeChanged', { theme: this.themeService.theme });
}
private sendContent() {
this.sendMessage('contentChanged', { content: this.contentItem });
}

4
frontend/src/app/features/content/shared/forms/assets-editor.component.scss

@ -41,8 +41,8 @@
.btn-add {
&.drag {
border-color: color.adjust($color-theme-secondary, $lightness: -20%);
color: color.adjust($color-border, $lightness: -40%);
border-color: $color-theme-secondary-contrast-20;
color: $color-border-contrast-40;
cursor: copy;
}
}

2
frontend/src/app/features/content/shared/forms/content-field.component.scss

@ -25,7 +25,7 @@
.change-marker {
@include absolute(-1.5rem, null, null, 0);
background: $color-white;
background: $color-surface;
border: 1px solid $color-border;
border-radius: $border-radius;
font-size: $font-smallest;

6
frontend/src/app/features/content/shared/forms/field-editor.component.scss

@ -20,7 +20,7 @@
&.expanded {
@include absolute(0, 0, 0, 0);
background-color: $color-white;
background-color: $color-surface;
border: 0;
border-radius: 0;
overflow-x: hidden;
@ -44,8 +44,8 @@
margin-bottom: 1rem;
&-separator {
border-bottom: 1px solid color.adjust($color-border, $lightness: -5%);
color: color.adjust($color-text, $lightness: 20%);
border-bottom: 1px solid $color-border-contrast-5;
color: $color-text-muted-20;
font-size: 1.3rem;
font-weight: normal;
margin-bottom: 0;

2
frontend/src/app/features/content/shared/forms/iframe-editor.component.scss

@ -9,7 +9,7 @@ iframe {
.fullscreen {
@include fixed(0, 0, 0, 0);
background: $color-white;
background: $color-surface;
border: 0;
border-radius: 0;
z-index: 1040;

15
frontend/src/app/features/content/shared/forms/iframe-editor.component.ts

@ -8,7 +8,7 @@
import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, HostListener, Input, numberAttribute, OnDestroy, Output, Renderer2, ViewChild } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { Router } from '@angular/router';
import { AppLanguageDto, AppsState, AssetDto, AssetSelectorComponent, computeEditorUrl, ContentDto, ContentSelectorComponent, DialogModel, DialogService, disabled$, ModalDirective, SafeResourceUrlPipe, StatefulComponent, Subscriptions, TypedSimpleChanges, Types, value$ } from '@app/shared';
import { AppLanguageDto, AppsState, AssetDto, AssetSelectorComponent, computeEditorUrl, ContentDto, ContentSelectorComponent, DialogModel, DialogService, disabled$, ModalDirective, SafeResourceUrlPipe, StatefulComponent, Subscriptions, ThemeService, TypedSimpleChanges, Types, value$ } from '@app/shared';
interface State {
// True, when the editor is shown as fullscreen.
@ -29,6 +29,7 @@ interface State {
})
export class IFrameEditorComponent extends StatefulComponent<State> implements OnDestroy {
private readonly subscriptions = new Subscriptions();
private readonly themeSubscriptions = new Subscriptions();
private value: any;
private isInitialized = false;
private isDisabled = false;
@ -98,8 +99,15 @@ export class IFrameEditorComponent extends StatefulComponent<State> implements O
private readonly dialogs: DialogService,
private readonly renderer: Renderer2,
private readonly router: Router,
private readonly themeService: ThemeService,
) {
super({ isFullscreen: false });
this.themeSubscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.sendTheme();
}));
}
public ngOnDestroy() {
@ -156,6 +164,7 @@ export class IFrameEditorComponent extends StatefulComponent<State> implements O
if (type === 'started') {
this.isInitialized = true;
this.sendTheme();
this.sendInit();
this.sendFullscreen();
this.sendExpanded();
@ -291,6 +300,10 @@ export class IFrameEditorComponent extends StatefulComponent<State> implements O
this.sendMessage('init', { context: { ...this.context || {}, field: this.formField } });
}
private sendTheme() {
this.sendMessage('themeChanged', { theme: this.themeService.theme });
}
private sendValue() {
this.sendMessage('valueChanged', { value: this.value });
}

6
frontend/src/app/features/content/shared/forms/stock-photo-editor.component.scss

@ -1,12 +1,10 @@
@import 'mixins';
@import 'vars';
$color-user-background: rgba(0, 0, 0, 50%);
$color-background: #000;
.preview {
align-items: center;
background: $color-background;
background: $color-black;
border: 0;
border-radius: 0;
text-align: center;
@ -63,7 +61,7 @@ $color-background: #000;
&-user {
@include absolute(auto, 0, 0, 0);
background: $color-user-background;
background: $color-overlay-dark;
border: 0;
padding: .5rem .75rem;
}

6
frontend/src/app/features/content/shared/list/content.component.scss

@ -6,7 +6,7 @@
.edit-menu {
@include absolute(.5rem, auto, auto, .5rem);
background: $color-white;
background: $color-surface;
border-right: 1px solid $color-border;
padding-right: 1rem;
white-space: nowrap;
@ -15,12 +15,12 @@
}
tr {
background-color: $color-white;
background-color: $color-surface;
}
td {
border-bottom: .7px solid $color-border;
border-left: 1px solid $color-white;
border-left: 1px solid $color-surface;
border-top: 0 !important;
position: relative;
vertical-align: middle;

2
frontend/src/app/features/content/shared/references/reference-item.component.scss

@ -7,7 +7,7 @@
.reference-menu {
@include absolute(0, -.25rem, auto, auto);
background: $color-white;
background: $color-surface;
border: 0;
border-left: 1px solid $color-border;
padding-left: 1rem;

2
frontend/src/app/features/content/shared/references/references-editor.component.scss

@ -32,7 +32,7 @@
}
.invalid {
color: color.adjust($color-border, $lightness: -30%);
color: $color-border-contrast-30;
font-size: 1.2rem;
font-weight: normal;
padding: 2rem;

2
frontend/src/app/features/dashboard/pages/dashboard-page.component.scss

@ -112,7 +112,7 @@ gridster-item {
&-href {
&:hover {
@include box-shadow-outer(0, 3px, 16px, .2);
@include box-shadow-outer(0, 3px, 16px, $color-shadow-20);
}
}
}

4
frontend/src/app/features/rules/pages/rule/branch.component.scss

@ -105,9 +105,9 @@
.white-label {
display: inline-block;
background-color: $color-white;
background-color: $color-surface;
border-radius: 0;
border-color: $color-white;
border-color: $color-surface;
padding: 0.125rem 0.25rem;
}

10
frontend/src/app/features/rules/pages/rule/rule-page.component.scss

@ -2,7 +2,7 @@
@import "mixins";
@import "vars";
$background-color: color.adjust($color-border, $lightness: 2%);
$background-color: $color-border-muted-2;
:host ::ng-deep {
.panel2-main-inner.white {
@ -23,17 +23,17 @@ $background-color: color.adjust($color-border, $lightness: 2%);
.btn-enabled {
@include absolute(1.5rem, 1.75rem, null, null);
background-color: $color-white;
background-color: $color-surface;
&:hover {
background-color: $color-white;
background-color: $color-surface;
}
}
.btn-circle {
@include force-height(4rem);
@include force-width(4rem);
background-color: $color-white;
background-color: $color-surface;
border-radius: 100%;
border-color: $color-border;
padding: 1rem;
@ -84,7 +84,7 @@ $background-color: color.adjust($color-border, $lightness: 2%);
label {
@include truncate;
background-color: $color-white;
background-color: $color-surface;
display: inline-block;
max-width: 7rem;
padding: 0.125rem 0.25rem;

2
frontend/src/app/features/rules/shared/history-step.component.scss

@ -28,7 +28,7 @@
.circle {
@include circle(2rem);
border: 1px solid $color-border;
background: $color-white;
background: $color-surface;
position: relative;
&.sm {

2
frontend/src/app/features/rules/shared/rule-element.component.scss

@ -13,7 +13,7 @@
@include absolute(.25rem, null, null, -1rem);
border-radius: 100%;
border-color: $color-theme-error;
background-color: $color-white;
background-color: $color-surface;
display: none;
&:hover {

3
frontend/src/app/features/schemas/pages/schema/fields/field-group.component.scss

@ -1,10 +1,9 @@
@import 'mixins';
@import 'vars';
$field-line: #c7cfd7;
.field-placeholder {
border: 2px dashed $field-line;
border: 2px dashed $color-field-line;
border-radius: 0;
margin-bottom: .25rem;
margin-top: 0;

10
frontend/src/app/features/schemas/pages/schema/fields/field.component.scss

@ -2,8 +2,6 @@
@import 'mixins';
@import 'vars';
$field-header: #e7ebef;
$field-line: #c7cfd7;
$padding: 1rem;
.table-items-row-details {
@ -24,7 +22,7 @@ $padding: 1rem;
border-radius: 0;
.table-items-row-details {
background: $color-white;
background: $color-surface;
border: 1px solid $color-border;
border-radius: $border-radius;
}
@ -62,14 +60,14 @@ $padding: 1rem;
&-line-v {
@include absolute($padding, auto, 3 * $padding + .25rem, $padding);
border: 0;
border-left: 2px dashed $field-line;
border-left: 2px dashed $color-field-line;
width: 2px;
}
&-line-h {
@include absolute(-2px, auto, 50%, -$padding);
border: 0;
border-bottom: 2px dashed $field-line;
border-bottom: 2px dashed $color-field-line;
width: $padding - .25rem;
}
}
@ -91,7 +89,7 @@ $padding: 1rem;
}
&-hidden {
color: color.adjust($color-text-decent, $lightness: 40%);
color: $color-text-decent-muted-40;
}
&-partitioning {

2
frontend/src/app/features/schemas/pages/schema/fields/schema-fields.component.scss

@ -10,7 +10,7 @@
.field-button {
@include circle(5.25rem);
@include box-shadow-outer(0, 8px, 16px, .3);
@include box-shadow-outer(0, 8px, 16px, $color-shadow-30);
@include absolute(auto, 6rem, 1rem, auto);
&-icon {

2
frontend/src/app/features/schemas/pages/schema/indexes/schema-indexes.component.scss

@ -3,7 +3,7 @@
.index-button {
@include circle(5.25rem);
@include box-shadow-outer(0, 8px, 16px, .3);
@include box-shadow-outer(0, 8px, 16px, $color-shadow-30);
@include absolute(auto, 6rem, 1rem, auto);
&-icon {

2
frontend/src/app/features/schemas/pages/schema/ui/field-list.component.scss

@ -10,7 +10,7 @@
&-assigned {
@include absolute(0, 50%, 0, 0);
border-right: 1px solid color.adjust($color-input, $lightness: -2%);
border-right: 1px solid $color-input-contrast-2;
}
&-available {

2
frontend/src/app/features/settings/pages/clients/client-connect-form.component.scss

@ -79,7 +79,7 @@ sqx-code {
position: relative;
&:hover {
border-color: color.adjust($color-border, $lightness: -10%);
border-color: $color-border-contrast-10;
}
i {

3
frontend/src/app/features/settings/pages/languages/language.component.scss

@ -1,7 +1,6 @@
@import 'mixins';
@import 'vars';
$field-header: #e7ebef;
.language {
&-master {
@ -23,7 +22,7 @@ $field-header: #e7ebef;
}
&-language {
background: $color-white;
background: $color-surface;
border: 0;
border-radius: $border-radius;
line-height: 2rem;

20
frontend/src/app/features/settings/pages/script-logs/script-log.component.scss

@ -1,12 +1,6 @@
@import 'mixins';
@import 'vars';
$console-background: #1e1f22;
$console-text: #d4d4d4;
$console-muted: #7f848e;
$console-info: #4fc1ff;
$console-warn: #e5c07b;
$console-error: #f48771;
h4 {
font-size: 1rem;
@ -15,10 +9,10 @@ h4 {
}
.console {
background: $console-background;
background: $color-console-background;
border-bottom-left-radius: $border-radius;
border-bottom-right-radius: $border-radius;
color: $console-text;
color: $color-console-text;
font-family: monospace;
font-size: .85rem;
line-height: 1.5;
@ -41,23 +35,23 @@ h4 {
&-time,
&-debug {
color: $console-muted;
color: $color-console-muted;
}
&-info {
color: $console-info;
color: $color-console-info;
}
&-warn {
color: $console-warn;
color: $color-console-warn;
}
&-error {
color: $console-error;
color: $color-console-error;
}
&-omitted {
color: $console-muted;
color: $color-console-muted;
font-style: italic;
font-weight: normal;
}

35
frontend/src/app/features/settings/pages/workflows/workflow-diagram.component.ts

@ -6,7 +6,7 @@
*/
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, ViewChild } from '@angular/core';
import { ListViewComponent, ResourceLoaderService, WorkflowView } from '@app/shared';
import { ListViewComponent, ResourceLoaderService, Subscriptions, ThemeService, WorkflowView } from '@app/shared';
declare const vis: any;
@ -19,6 +19,7 @@ declare const vis: any;
],
})
export class WorkflowDiagramComponent implements AfterViewInit, OnDestroy {
private readonly subscriptions = new Subscriptions();
private network: any;
@ViewChild('chartContainer', { static: false })
@ -31,7 +32,13 @@ export class WorkflowDiagramComponent implements AfterViewInit, OnDestroy {
constructor(
private readonly resourceLoader: ResourceLoaderService,
private readonly themeService: ThemeService,
) {
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.updateNetwork();
}));
}
public ngOnDestroy() {
@ -53,10 +60,17 @@ export class WorkflowDiagramComponent implements AfterViewInit, OnDestroy {
await this.resourceLoader.loadLocalScript('dependencies/vis-network/vis-network.min.js');
const { edges, nodes } = buildGraph(this.workflow);
const colors = {
edge: this.themeService.getColor('diagram-edge'),
start: this.themeService.getColor('diagram-start'),
text: this.themeService.getColor('diagram-text'),
textStroke: this.themeService.getColor('diagram-text-stroke'),
};
const { edges, nodes } = buildGraph(this.workflow, colors);
this.network?.destroy();
this.network = new vis.Network(this.chartContainer.nativeElement, { edges, nodes }, GRAPH_OPTIONS);
this.network = new vis.Network(this.chartContainer.nativeElement, { edges, nodes }, buildOptions(colors));
this.network.stabilize();
this.network.fit();
@ -64,7 +78,9 @@ export class WorkflowDiagramComponent implements AfterViewInit, OnDestroy {
}
}
function buildGraph(workflow: WorkflowView) {
type DiagramColors = { edge: string; start: string; text: string; textStroke: string };
function buildGraph(workflow: WorkflowView, colors: DiagramColors) {
const nodes = new vis.DataSet();
for (const step of workflow.steps) {
@ -92,7 +108,7 @@ function buildGraph(workflow: WorkflowView) {
}
if (workflow.dto.initial) {
nodes.add({ id: 0, color: '#000', label: 'Start', shape: 'dot', size: 3 });
nodes.add({ id: 0, color: colors.start, label: 'Start', shape: 'dot', size: 3 });
}
const edges = new vis.DataSet();
@ -120,7 +136,7 @@ function buildGraph(workflow: WorkflowView) {
return { edges, nodes };
}
const GRAPH_OPTIONS = {
const buildOptions = (colors: DiagramColors) => ({
nodes: {
borderWidth: 2,
font: {
@ -132,6 +148,7 @@ const GRAPH_OPTIONS = {
bold: {
size: 20,
},
color: colors.text,
size: 16,
},
shape: 'dot',
@ -144,9 +161,11 @@ const GRAPH_OPTIONS = {
ital: {
size: 16,
},
color: colors.text,
size: 16,
strokeColor: colors.textStroke,
},
color: 'gray',
color: colors.edge,
},
layout: {
randomSeed: 2,
@ -158,4 +177,4 @@ const GRAPH_OPTIONS = {
},
solver: 'repulsion',
},
};
});

2
frontend/src/app/features/teams/pages/dashboard/dashboard-page.component.scss

@ -112,7 +112,7 @@ gridster-item {
&-href {
&:hover {
@include box-shadow-outer(0, 3px, 16px, .2);
@include box-shadow-outer(0, 3px, 16px, $color-shadow-20);
}
}
}

2
frontend/src/app/framework/angular/dropdown-menu.component.scss

@ -2,6 +2,6 @@
@import 'vars';
:host {
background-color: $color-white;
background-color: $color-surface;
display: block;
}

6
frontend/src/app/framework/angular/forms/editors/code-editor.component.scss

@ -6,7 +6,7 @@
:host ::ng-deep {
.ace_editor {
background: $color-white;
background: $color-surface;
&.no-border {
border: 0;
@ -14,7 +14,7 @@
}
.ace_tooltip {
background: $color-white;
background: $color-surface;
border: 1px solid $color-input;
border-radius: 0;
line-height: 1.6;
@ -29,7 +29,7 @@
}
.ace_gutter-active-line {
background: color.adjust($color-border, $lightness: -5%) !important;
background: $color-border-contrast-5 !important;
}
.ace_gutter {

12
frontend/src/app/framework/angular/forms/editors/code-editor.component.ts

@ -5,10 +5,10 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { AfterViewInit, booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, forwardRef, Input, numberAttribute, ViewChild } from '@angular/core';
import { AfterViewInit, booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, forwardRef, inject, Input, numberAttribute, ViewChild } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { debounceTime, Subject } from 'rxjs';
import { ResourceLoaderService, ScriptCompletion, ScriptCompletions, StatefulControlComponent, TypedSimpleChanges, Types } from '@app/framework/internal';
import { ResourceLoaderService, ScriptCompletion, ScriptCompletions, StatefulControlComponent, Subscriptions, ThemeService, TypedSimpleChanges, Types } from '@app/framework/internal';
import { FocusComponent } from '../forms-helper';
export const SQX_CODE_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
@ -27,6 +27,8 @@ type Editor = AceAjax.Editor & { completers?: AceAjax.Completer[]; completer?: {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CodeEditorComponent extends StatefulControlComponent<{}, any> implements AfterViewInit, FocusComponent {
private readonly subscriptions = new Subscriptions();
private readonly themeService = inject(ThemeService);
private aceModes?: ModeList;
private aceEditor?: Editor;
private aceTools = false;
@ -169,6 +171,12 @@ export class CodeEditorComponent extends StatefulControlComponent<{}, any> imple
this.setWordWrap();
this.onDisabled(this.snapshot.isDisabled);
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(theme => {
this.aceEditor?.setTheme(theme === 'dark' ? 'ace/theme/one_dark' : 'ace/theme/textmate');
}));
if (this.aceTools && !this.disableTools) {
const originalCompleter = this.aceEditor.completer!;
const originalShowDocTooltip = originalCompleter.showDocTooltip;

1
frontend/src/app/framework/angular/forms/editors/dropdown.component.scss

@ -1,7 +1,6 @@
@import 'mixins';
@import 'vars';
$color-input-disabled: #eef1f4;
.form-select {
cursor: default;

3
frontend/src/app/framework/angular/forms/editors/stars.component.scss

@ -1,7 +1,6 @@
@import 'mixins';
@import 'vars';
$color-gold: #ffd700;
.many-stars {
color: $color-text-decent;
@ -25,7 +24,7 @@ $color-gold: #ffd700;
vertical-align: middle;
&::before {
color: $color-gold;
color: $color-stars;
content: '☆';
display: inline-block;
font-size: 1.8rem;

8
frontend/src/app/framework/angular/forms/editors/tag-editor.component.scss

@ -2,8 +2,6 @@
@import 'mixins';
@import 'vars';
$focus-color: #b3d3ff;
$focus-shadow: rgba(51, 137, 255, 25%);
$inner-height: 1.75rem;
/* stylelint-disable no-descending-specificity */
@ -43,9 +41,9 @@ $inner-height: 1.75rem;
}
&.focus {
border-color: $focus-color;
border-color: $color-tag-focus;
border-width: 1px;
box-shadow: 0 0 0 .2rem $focus-shadow;
box-shadow: 0 0 0 .2rem $color-tag-focus-shadow;
}
&.singleline {
@ -170,7 +168,7 @@ div {
}
&:hover {
background: color.adjust($color-input, $lightness: -10%);
background: $color-input-contrast-10;
}
}

4
frontend/src/app/framework/angular/forms/editors/toggle.component.scss

@ -13,7 +13,7 @@ $toggle-button-size: $toggle-height - .25rem;
.toggle {
&-button {
@include circle($toggle-button-size);
@include box-shadow-outer(0, 2px, 2px, .2);
@include box-shadow-outer(0, 2px, 2px, $color-shadow-20);
@include absolute($toggle-height * .5, auto, auto, $toggle-width * .5);
background: $color-white;
border: 0;
@ -24,7 +24,7 @@ $toggle-button-size: $toggle-height - .25rem;
&-container {
@include box-shadow-outer;
background: color.adjust($color-border, $lightness: 6%);
background: $color-border-muted-6;
border: 0;
border-radius: $toggle-height * .5;
height: $toggle-height;

3
frontend/src/app/framework/angular/forms/form-alert.component.scss

@ -1,7 +1,6 @@
@import 'mixins';
@import 'vars';
$color: #fcfeff;
:host {
display: block;
@ -10,5 +9,5 @@ $color: #fcfeff;
}
.light {
background: $color;
background: $color-alert-light-background;
}

27
frontend/src/app/framework/angular/forms/progress-bar.component.ts

@ -7,7 +7,7 @@
import { booleanAttribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, numberAttribute, OnInit, Renderer2 } from '@angular/core';
import * as ProgressBar from 'progressbar.js';
import { TypedSimpleChanges } from '@app/framework/internal';
import { Subscriptions, ThemeService, TypedSimpleChanges } from '@app/framework/internal';
@Component({
selector: 'sqx-progress-bar',
@ -20,16 +20,17 @@ import { TypedSimpleChanges } from '@app/framework/internal';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ProgressBarComponent implements OnInit {
private readonly subscriptions = new Subscriptions();
private progressBar: any;
@Input()
public mode = 'Line';
@Input()
public color = '#3d7dd5';
public color?: string;
@Input()
public trailColor = '#f4f4f4';
public trailColor?: string;
@Input({ transform: numberAttribute })
public trailWidth = 4;
@ -49,14 +50,15 @@ export class ProgressBarComponent implements OnInit {
constructor(changeDetector: ChangeDetectorRef,
private readonly element: ElementRef,
private readonly renderer: Renderer2,
private readonly themeService: ThemeService,
) {
changeDetector.detach();
}
public ngOnInit() {
const options = {
color: this.color,
trailColor: this.trailColor,
color: this.getColor(),
trailColor: this.getTrailColor(),
trailWidth: this.trailWidth,
strokeWidth: this.strokeWidth,
svgStyle: { width: '100%', height: '100%' },
@ -71,6 +73,13 @@ export class ProgressBarComponent implements OnInit {
}
this.updateValue();
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.progressBar.path?.setAttribute('stroke', this.getColor());
this.progressBar.trail?.setAttribute('stroke', this.getTrailColor());
}));
}
public ngOnChanges(changes: TypedSimpleChanges<this>) {
@ -79,6 +88,14 @@ export class ProgressBarComponent implements OnInit {
}
}
private getColor() {
return this.color || this.themeService.getColor('progress');
}
private getTrailColor() {
return this.trailColor || this.themeService.getColor('progress-trail');
}
private updateValue() {
const value = this.value;

2
frontend/src/app/framework/angular/list-view.component.scss

@ -68,7 +68,7 @@
overflow-y: hidden;
&.tabled2 {
background-color: $color-white;
background-color: $color-surface;
}
.sync-inner {

5
frontend/src/app/framework/angular/modals/tour-template.component.scss

@ -1,12 +1,11 @@
@import 'mixins';
@import 'vars';
$hide-shadow: rgba(0, 0, 0, 50%);
.tour {
&-step {
@include box-shadow-outer(0, 0, 4px, .2);
background: $color-white;
@include box-shadow-outer(0, 0, 4px, $color-shadow-20);
background: $color-surface;
border: 0;
border-radius: 0;
}

3
frontend/src/app/framework/angular/video-player.component.scss

@ -1,10 +1,9 @@
@import 'mixins';
@import 'vars';
$color-video: #000;
:host {
background: $color-video;
background: $color-black;
}
:host ::ng-deep {

1
frontend/src/app/framework/internal.ts

@ -23,6 +23,7 @@ export * from './services/resize.service';
export * from './services/resource-loader.service';
export * from './services/shortcut.service';
export * from './services/temp.service';
export * from './services/theme.service';
export * from './services/title.service';
export * from './services/toolbar.service';
export * from './utils/angular';

140
frontend/src/app/framework/services/theme.service.spec.ts

@ -0,0 +1,140 @@
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { DOCUMENT } from '@angular/common';
import { TestBed } from '@angular/core/testing';
import { LocalStoreService } from './local-store.service';
import { Theme, ThemeService } from './theme.service';
describe('ThemeService', () => {
let listeners: (() => void)[];
let systemDark: boolean;
let localStore: LocalStoreService;
let documentElement: HTMLElement;
beforeEach(() => {
listeners = [];
systemDark = false;
documentElement = document.createElement('html');
const fakeDocument = {
documentElement,
defaultView: {
getComputedStyle: () => ({
getPropertyValue: (name: string) => name === '--sqx-progress' ? ' #3d7dd5 ' : '',
}),
matchMedia: () => ({
get matches() {
return systemDark;
},
addEventListener: (_: string, listener: () => void) => listeners.push(listener),
removeEventListener: () => {},
}),
},
};
localStore = new LocalStoreService();
localStore.configureStore(createStore());
TestBed.configureTestingModule({
providers: [
{ provide: DOCUMENT, useValue: fakeDocument },
{ provide: LocalStoreService, useValue: localStore },
],
});
});
it('should use light theme from system by default', () => {
const themeService = TestBed.inject(ThemeService);
expect(themeService.mode).toEqual('system');
expect(themeService.theme).toEqual('light');
expect(documentElement.getAttribute('data-bs-theme')).toEqual('light');
});
it('should use dark theme from system', () => {
systemDark = true;
const themeService = TestBed.inject(ThemeService);
expect(themeService.mode).toEqual('system');
expect(themeService.theme).toEqual('dark');
expect(documentElement.getAttribute('data-bs-theme')).toEqual('dark');
});
it('should restore mode from local store', () => {
localStore.set('squidex.theme', 'dark');
const themeService = TestBed.inject(ThemeService);
expect(themeService.mode).toEqual('dark');
expect(themeService.theme).toEqual('dark');
});
it('should ignore invalid mode from local store', () => {
localStore.set('squidex.theme', 'invalid');
const themeService = TestBed.inject(ThemeService);
expect(themeService.mode).toEqual('system');
});
it('should store and apply mode', () => {
const themeService = TestBed.inject(ThemeService);
themeService.setMode('dark');
expect(localStore.get('squidex.theme')).toEqual('dark');
expect(themeService.theme).toEqual('dark');
expect(documentElement.getAttribute('data-bs-theme')).toEqual('dark');
});
it('should get color from CSS variable', () => {
const themeService = TestBed.inject(ThemeService);
expect(themeService.getColor('progress')).toEqual('#3d7dd5');
expect(themeService.getColor('unknown')).toEqual('');
});
it('should follow system changes if mode is system', () => {
const themeService = TestBed.inject(ThemeService);
const themes: Theme[] = [];
themeService.themeChanges.subscribe(theme => {
themes.push(theme);
});
systemDark = true;
listeners.forEach(x => x());
expect(themes).toEqual(['light', 'dark']);
});
it('should not follow system changes if mode is explicit', () => {
const themeService = TestBed.inject(ThemeService);
themeService.setMode('light');
systemDark = true;
listeners.forEach(x => x());
expect(themeService.theme).toEqual('light');
});
});
function createStore() {
const values: Record<string, string> = {};
return {
getItem: (key: string) => values[key] ?? null,
setItem: (key: string, value: string) => {
values[key] = value;
},
};
}

82
frontend/src/app/framework/services/theme.service.ts

@ -0,0 +1,82 @@
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { DOCUMENT } from '@angular/common';
import { inject, Injectable, OnDestroy } from '@angular/core';
import { BehaviorSubject, distinctUntilChanged, map, Observable } from 'rxjs';
import { LocalStoreService } from './local-store.service';
export type ThemeMode = 'light' | 'dark' | 'system';
export type Theme = 'light' | 'dark';
const THEME_MODES: ReadonlyArray<ThemeMode> = ['light', 'dark', 'system'];
const THEME_KEY = 'squidex.theme';
@Injectable({
providedIn: 'root',
})
export class ThemeService implements OnDestroy {
private readonly document = inject(DOCUMENT);
private readonly localStore = inject(LocalStoreService);
private readonly systemQuery = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
private readonly systemListener = () => this.update();
private readonly state$ = new BehaviorSubject<{ mode: ThemeMode; theme: Theme }>({ mode: 'system', theme: 'light' });
public get mode(): ThemeMode {
return this.state$.value.mode;
}
public get theme(): Theme {
return this.state$.value.theme;
}
public get modeChanges(): Observable<ThemeMode> {
return this.state$.pipe(map(x => x.mode), distinctUntilChanged());
}
public get themeChanges(): Observable<Theme> {
return this.state$.pipe(map(x => x.theme), distinctUntilChanged());
}
constructor() {
this.systemQuery?.addEventListener?.('change', this.systemListener);
this.update(parseMode(this.localStore.get(THEME_KEY)));
}
public ngOnDestroy() {
this.systemQuery?.removeEventListener?.('change', this.systemListener);
}
public getColor(name: string) {
// Colors are defined in _colors.scss and exposed as CSS variables for the current theme.
const style = this.document.defaultView?.getComputedStyle?.(this.document.documentElement);
return style?.getPropertyValue(`--sqx-${name}`).trim() || '';
}
public setMode(mode: ThemeMode) {
this.localStore.set(THEME_KEY, mode);
this.update(mode);
}
private update(mode = this.mode) {
const theme = mode === 'system' ? (this.systemQuery?.matches ? 'dark' : 'light') : mode;
// Bootstrap and our own CSS variables are switched by this attribute.
this.document.documentElement.setAttribute('data-bs-theme', theme);
this.state$.next({ mode, theme });
}
}
function parseMode(value: string | null): ThemeMode {
return THEME_MODES.includes(value as ThemeMode) ? value as ThemeMode : 'system';
}

2
frontend/src/app/shared/components/app-form.component.scss

@ -11,7 +11,7 @@
}
.col-info {
background-color: color.adjust($color-background, $lightness: 2%);
background-color: $color-background-muted-2;
border-radius: 0;
border-left: 1px solid $color-border;
padding: 1.5rem 2rem;

2
frontend/src/app/shared/components/assets/asset-selector.component.scss

@ -23,6 +23,6 @@
}
.modal-tabs {
background: $color-white;
background: $color-surface;
}
}

2
frontend/src/app/shared/components/assets/asset.component.scss

@ -158,7 +158,7 @@ $list-height: 2.25rem;
background: none;
border: 0;
border-radius: 0;
color: color.adjust($color-white, $lightness: -10%);
color: $color-white-contrast-10;
cursor: pointer;
font-size: 1.1rem;
font-weight: normal;

4
frontend/src/app/shared/components/assets/assets-list.component.scss

@ -51,7 +51,7 @@ h5 {
transition: border-color .4s ease;
&.drag {
border-color: color.adjust($color-border, $lightness: -10%);
border-color: $color-border-contrast-10;
border-style: dashed;
cursor: copy;
}
@ -69,7 +69,7 @@ h5 {
}
&-info {
color: color.adjust($color-border, $lightness: -30%);
color: $color-border-contrast-30;
}
}

18
frontend/src/app/shared/components/cards/iframe-card.component.ts

@ -6,7 +6,7 @@
*/
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, HostListener, Input, ViewChild } from '@angular/core';
import { ApiUrlConfig, Types } from '@app/framework';
import { ApiUrlConfig, Subscriptions, ThemeService, Types } from '@app/framework';
import { AppDto, AuthService, TeamDto } from '@app/shared/internal';
@Component({
@ -16,6 +16,7 @@ import { AppDto, AuthService, TeamDto } from '@app/shared/internal';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class IFrameCardComponent implements AfterViewInit {
private readonly subscriptions = new Subscriptions();
private readonly context: any;
private isInitialized = false;
@ -41,8 +42,16 @@ export class IFrameCardComponent implements AfterViewInit {
}
}
constructor(apiUrl: ApiUrlConfig, authService: AuthService) {
constructor(apiUrl: ApiUrlConfig, authService: AuthService,
private readonly themeService: ThemeService,
) {
this.context = { apiUrl: apiUrl.buildUrl('api'), user: authService.user };
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.sendTheme();
}));
}
public ngAfterViewInit() {
@ -57,11 +66,16 @@ export class IFrameCardComponent implements AfterViewInit {
if (type === 'started') {
this.isInitialized = true;
this.sendTheme();
this.sendInit();
}
}
}
private sendTheme() {
this.sendMessage('themeChanged', { theme: this.themeService.theme });
}
private sendInit() {
this.sendMessage('init', { context: this.context });
}

23
frontend/src/app/shared/components/cards/shared.ts

@ -5,8 +5,8 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { ChartOptions as IChartOptions } from 'chart.js';
import { DateTime } from '@app/framework';
import { Chart, ChartOptions as IChartOptions } from 'chart.js';
import { DateTime, ThemeService } from '@app/framework';
const ColorSchema: ReadonlyArray<string> = [
' 51, 137, 213',
@ -44,6 +44,25 @@ export module ChartHelpers {
}
}
export function syncChartTheme(themeService: ThemeService) {
return themeService.themeChanges.subscribe(() => {
const text = themeService.getColor('chart-text');
const grid = themeService.getColor('chart-grid');
// Keep the defaults of chart.js if the styles are not loaded yet.
if (!text || !grid) {
return;
}
Chart.defaults.color = text;
Chart.defaults.borderColor = grid;
for (const chart of Object.values(Chart.instances)) {
chart.update();
}
});
}
export module ChartOptions {
export const Default: IChartOptions = {
responsive: true,

6
frontend/src/app/shared/components/chat-item.component.scss

@ -8,7 +8,7 @@
}
.bubble {
background-color: $color-white;
background-color: $color-surface;
border: 0;
border-radius: $border-radius;
padding: 1rem;
@ -16,14 +16,14 @@
&-right {
&::before {
@include caret-left($color-white, 10px);
@include caret-left($color-surface, 10px);
@include absolute(.5rem, null, null, -18px);
}
}
&-left {
&::before {
@include caret-right($color-white, 10px);
@include caret-right($color-surface, 10px);
@include absolute(.5rem, -18px);
}
}

2
frontend/src/app/shared/components/comments/comment.component.scss

@ -24,7 +24,7 @@
}
.comment {
background-color: $color-white;
background-color: $color-surface;
border-radius: 2px;
border: 1px solid transparent;
font-size: .85rem;

2
frontend/src/app/shared/components/comments/comments.component.scss

@ -13,7 +13,7 @@
.comments-header {
.form-control {
border-color: $color-white;
border-color: $color-surface;
border-bottom-color: $color-border;
border-radius: 0;

4
frontend/src/app/shared/components/contents/content-value.component.scss

@ -12,7 +12,7 @@
.btn {
@include absolute(.5rem, .25rem);
background-color: $color-white;
background-color: $color-surface;
border: 1px solid $color-border;
border-radius: $border-radius;
display: none;
@ -54,7 +54,7 @@
.preview {
img {
@include box-shadow-outer(0, 3px, 16px, 0.2);
@include box-shadow-outer(0, 3px, 16px, $color-shadow-20);
background-image: $asset-background;
max-width: 300px;
max-height: 300px;

19
frontend/src/app/shared/components/forms/rich-editor.component.ts

@ -9,7 +9,7 @@ import { AsyncPipe } from '@angular/common';
import { AfterViewInit, booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, forwardRef, Input, OnDestroy, Output, ViewChild } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { BehaviorSubject, catchError, of, switchMap } from 'rxjs';
import { HTTP, ModalDirective, TypedSimpleChanges } from '@app/framework';
import { HTTP, ModalDirective, Subscriptions, ThemeService, TypedSimpleChanges } from '@app/framework';
import { ApiUrlConfig, AppLanguageDto, AppsState, AssetDto, AssetsService, AssetUploaderState, ContentDto, DialogModel, getContentValue, ResourceLoaderService, StatefulControlComponent, Types } from '@app/shared/internal';
import { AssetDialogComponent } from '../assets/asset-dialog.component';
import { AssetSelectorComponent } from '../assets/asset-selector.component';
@ -38,6 +38,7 @@ export const SQX_RICH_EDITOR_CONTROL_VALUE_ACCESSOR: any = {
],
})
export class RichEditorComponent extends StatefulControlComponent<{}, EditorValue> implements AfterViewInit, OnDestroy {
private readonly subscriptions = new Subscriptions();
private readonly assetId = new BehaviorSubject<string | null>(null);
private editorWrapper?: SquidexEditorWrapper;
private value?: string;
@ -113,6 +114,7 @@ export class RichEditorComponent extends StatefulControlComponent<{}, EditorValu
private readonly assetUploader: AssetUploaderState,
private readonly assetService: AssetsService,
private readonly resourceLoader: ResourceLoaderService,
private readonly themeService: ThemeService,
) {
super({});
}
@ -198,9 +200,24 @@ export class RichEditorComponent extends StatefulControlComponent<{}, EditorValu
canSelectAssets: true,
canSelectContents: !!this.schemaIds,
classNames: this.classNames,
...this.editorColors(),
isDisabled: this.snapshot.isDisabled,
value: this.value || '',
});
this.subscriptions.add(
this.themeService.themeChanges
.subscribe(() => {
this.editorWrapper?.update(this.editorColors());
}));
}
private editorColors() {
return {
accentColor: this.themeService.getColor('editor-accent'),
baseColor: this.themeService.getColor('editor-base'),
borderColor: this.themeService.getColor('editor-border'),
};
}
public reset() {

3
frontend/src/app/shared/components/notifo.component.scss

@ -1,7 +1,6 @@
@import 'mixins';
@import 'vars';
$nav-link-text: rgba(0, 0, 0, 55%);
:host ::ng-deep {
.notifo {
@ -11,7 +10,7 @@ $nav-link-text: rgba(0, 0, 0, 55%);
margin-top: .125rem;
svg {
fill: $nav-link-text;
fill: $color-notifo-link;
}
}

2
frontend/src/app/shared/components/schema-category.component.scss

@ -37,7 +37,7 @@ $drag-margin: -8px;
}
.cdk-drag-preview {
background: $color-white !important;
background: $color-surface !important;
a {
color: $color-black !important;

2
frontend/src/app/shared/components/search/search-form.component.scss

@ -3,7 +3,7 @@
::ng-deep {
.nf-details {
background-color: $color-white;
background-color: $color-surface;
input, select, button {
height: auto;

10
frontend/src/app/shared/components/tour-guide.component.scss

@ -9,7 +9,7 @@ $caret-size: 14px;
}
.card {
@include box-shadow-outer(0, 2px, 5px, .2);
@include box-shadow-outer(0, 2px, 5px, $color-shadow-20);
margin-bottom: 1rem;
margin-top: 0;
max-width: 300px;
@ -31,7 +31,7 @@ $caret-size: 14px;
}
&::after {
@include caret-bottom($color-white, $caret-size);
@include caret-bottom($color-surface, $caret-size);
@include absolute(null, 15px, -$caret-size * 2 + 3, null);
}
}
@ -45,7 +45,7 @@ $caret-size: 14px;
&.active {
&:hover {
color: color.adjust($color-text, $lightness: -50%) !important;
color: $color-text-contrast-50 !important;
cursor: pointer
}
}
@ -86,7 +86,7 @@ $caret-size: 14px;
.counter {
@include circle(30px);
align-items: center;
background-color: rgba(0, 0, 0, 30%);
background-color: $color-overlay;
display: none;
flex-grow: 1;
flex-wrap: nowrap;
@ -95,7 +95,7 @@ $caret-size: 14px;
}
.squid {
@include box-shadow-outer(0, 2px, 4px, .1);
@include box-shadow-outer(0, 2px, 4px, $color-shadow-10);
border: 1px solid $color-border;
}

2
frontend/src/app/shared/components/watching-users.component.scss

@ -9,7 +9,7 @@
.user-item {
@include circle(2.3rem);
background-color: $color-white;
background-color: $color-surface;
display: inline-block;
margin-right: 0;
margin-left: -1.1rem;

2
frontend/src/app/shell/pages/internal/apps-menu.component.scss

@ -1,8 +1,6 @@
@import 'mixins';
@import 'vars';
$color-apps-border: #65a6ff;
$color-nav-shadow: rgba(26, 93, 184, 25%);
.dropdown {
&-button {

2
frontend/src/app/shell/pages/internal/internal-area.component.html

@ -1,5 +1,5 @@
@if (!isEmbedded) {
<nav class="navbar navbar-light navbar-expand fixed-top bg-white align-items-center">
<nav class="navbar navbar-light navbar-expand fixed-top align-items-center">
<span class="navbar-brand align-items-center justify-content-center d-flex" routerLink="/app">
<sqx-logo [isLoading]="loadingService.loading | async" />
</span>

3
frontend/src/app/shell/pages/internal/internal-area.component.scss

@ -2,7 +2,8 @@
@import 'vars';
.navbar {
@include box-shadow-outer(0, 2px, 3px, .13);
@include box-shadow-outer(0, 2px, 3px, $color-shadow-13);
background: $color-surface;
padding-left: $size-sidebar-width + 2rem;
}

14
frontend/src/app/shell/pages/internal/profile-menu.component.html

@ -17,8 +17,8 @@
}
<a class="dropdown-item" href="{{ snapshot.profileUrl }}" sqxExternalLink="noicon"> {{ "profile.title" | sqxTranslate }}</a>
<div class="dropdown-submenu">
<button class="dropdown-item dropdown-toggle" (click)="toggleSubmenu()" sqxStopClick type="button">{{ "common.language" | sqxTranslate }}</button>
<div class="dropdown-menu" [class.open]="snapshot.showSubmenu">
<button class="dropdown-item dropdown-toggle" (click)="toggleSubmenu('language')" sqxStopClick type="button">{{ "common.language" | sqxTranslate }}</button>
<div class="dropdown-menu" [class.open]="snapshot.submenu === 'language'">
@for (availableLanguage of languages; track availableLanguage) {
<button
class="dropdown-item"
@ -30,6 +30,16 @@
}
</div>
</div>
<div class="dropdown-submenu">
<button class="dropdown-item dropdown-toggle" (click)="toggleSubmenu('theme')" sqxStopClick type="button">{{ "common.theme" | sqxTranslate }}</button>
<div class="dropdown-menu" [class.open]="snapshot.submenu === 'theme'">
@for (themeMode of themeModes; track themeMode.mode) {
<button class="dropdown-item" [class.active]="themeMode.mode === (themeService.modeChanges | async)" (click)="changeTheme(themeMode.mode)" type="button">
{{ themeMode.label | sqxTranslate }}
</button>
}
</div>
</div>
<div class="dropdown-divider"></div>
<button class="dropdown-item" (click)="logout()" sqxExternalLink type="button">{{ "common.logout" | sqxTranslate }}</button>

25
frontend/src/app/shell/pages/internal/profile-menu.component.ts

@ -8,7 +8,7 @@
import { AsyncPipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
import { RouterLink } from '@angular/router';
import { ApiUrlConfig, AuthService, Cookies, DropdownMenuComponent, ExternalLinkDirective, ModalDirective, ModalModel, ModalPlacementDirective, StatefulComponent, StopClickDirective, Subscriptions, TranslatePipe, UILanguages, UIOptions, UIState, UserIdPicturePipe } from '@app/shared';
import { ApiUrlConfig, AuthService, Cookies, DropdownMenuComponent, ExternalLinkDirective, ModalDirective, ModalModel, ModalPlacementDirective, StatefulComponent, StopClickDirective, Subscriptions, ThemeMode, ThemeService, TranslatePipe, UILanguages, UIOptions, UIState, UserIdPicturePipe } from '@app/shared';
interface State {
// The display name of the user.
@ -23,8 +23,8 @@ interface State {
// The url to the user profile.
profileUrl: string;
// True when the submenu should be open.
showSubmenu: boolean;
// The submenu that is open.
submenu: 'language' | 'theme' | null;
}
@Component({
@ -52,17 +52,24 @@ export class ProfileMenuComponent extends StatefulComponent<State> implements On
public readonly language = inject(UIOptions).value.culture;
public readonly languages = UILanguages.ALL;
public readonly themeModes: ReadonlyArray<{ mode: ThemeMode; label: string }> = [
{ mode: 'light', label: 'common.themeLight' },
{ mode: 'dark', label: 'common.themeDark' },
{ mode: 'system', label: 'common.themeSystem' },
];
constructor(apiUrl: ApiUrlConfig,
public readonly uiState: UIState,
public readonly uiOptions: UIOptions,
public readonly authService: AuthService,
public readonly themeService: ThemeService,
) {
super({
profileDisplayName: '',
profileEmail: '',
profileId: '',
profileUrl: apiUrl.buildUrl('/identity-server/account/profile'),
showSubmenu: false,
submenu: null,
});
}
@ -90,19 +97,23 @@ export class ProfileMenuComponent extends StatefulComponent<State> implements On
location.reload();
}
public changeTheme(mode: ThemeMode) {
this.themeService.setMode(mode);
}
public toggleProfile() {
this.modalMenu.toggle();
this.next(s => ({
...s,
showSubmenu: false,
submenu: null,
}));
}
public toggleSubmenu() {
public toggleSubmenu(submenu: 'language' | 'theme') {
this.next(s => ({
...s,
showSubmenu: !s.showSubmenu,
submenu: s.submenu === submenu ? null : submenu,
}));
}

28
frontend/src/app/theme/_bootstrap-vars.scss

@ -5,6 +5,20 @@
$enable-cssgrid: true;
//
// COLOR MODES
//
$enable-dark-mode: true;
$color-mode-type: data;
$body-color-dark: $color-raw-dark-text;
$body-bg-dark: $color-raw-dark-background;
$body-emphasis-color-dark: $color-raw-dark-title;
$body-secondary-color-dark: $color-raw-dark-text-decent;
$body-secondary-bg-dark: $color-raw-dark-border-light;
$body-tertiary-bg-dark: $color-raw-dark-surface;
$border-color-dark: $color-raw-dark-border;
//
// GENERAL
//
@ -39,14 +53,14 @@ $primary: $color-theme-brand;
// Theme colors.
$danger: $color-theme-error;
$info: $color-theme-info;
$secondary: $color-theme-secondary;
$secondary: $color-raw-light-theme-secondary;
$success: $color-theme-success;
$warning: $color-theme-warning;
// Background.
$body-bg: $color-background;
$body-bg: $color-raw-light-background;
$body-secondary-color: $color-text-decent;
$body-secondary-color: $color-raw-light-text-decent;
// Borders.
$border-color: $color-border;
@ -67,10 +81,10 @@ $alert-link-font-weight: normal;
$label-margin-bottom: .25rem;
// Imputs
$input-bg: $color-white;
$input-bg: $color-input-background;
$input-border-color: $color-input;
$input-disabled-bg: $color-input-disabled;
$input-group-addon-bg: $color-white;
$input-group-addon-bg: $color-surface;
$input-placeholder-color: $color-input-placeholder;
$form-select-box-shadow: 0 0 0 0;
@ -79,7 +93,7 @@ $badge-bg-level: 2;
// Dropdown
$dropdown-border-color: 0;
$dropdown-box-shadow: 0 3px 16px rgba(0, 0, 0, .2);
$dropdown-box-shadow: 0 3px 16px $color-shadow;
$dropdown-divider-bg: $color-border-dark;
$dropdown-link-hover-bg: $color-theme-brand-light;
@ -89,7 +103,7 @@ $hr-opacity: 1;
// cards
$card-border-color: $color-border;
$card-border-radius: $border-radius;
$card-cap-bg: $color-white;
$card-cap-bg: $color-surface;
// Paragraphs
$paragraph-margin-bottom: .5rem;

72
frontend/src/app/theme/_bootstrap.scss

@ -91,7 +91,7 @@ a, button {
}
.alert-hint {
background: color.adjust($color-theme-brand, $lightness: 35%);
background: $color-hint-background;
border: 0;
border-radius: $border-radius;
color: $color-text;
@ -101,7 +101,7 @@ a, button {
position: relative;
&.light {
background: $color-white;
background: $color-surface;
border: 1px solid $color-border;
border-radius: $border-radius;
}
@ -154,7 +154,7 @@ a {
}
.navbar {
@include box-shadow-outer(0, 2px, 4px, .2);
@include box-shadow-outer(0, 2px, 4px, $color-shadow-20);
}
.navbar-nav {
@ -229,7 +229,7 @@ a {
&:disabled,
&.disabled {
color: color.adjust($color-theme-error, $lightness: 20%);
color: $color-theme-error-muted-20;
}
}
}
@ -248,7 +248,7 @@ a {
.breadcrumb-item {
& {
background: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" width="7" height="20"%3e%3cpath d="M0 0l7 10-7 10" fill="none" stroke="%23e4e7e9" stroke-width=".5"/%3e%3c/svg%3e');
background: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='7' height='20'><path d='M0 0l7 10-7 10' fill='none' stroke='#{$color-breadcrumb-arrow}' stroke-width='.5'/></svg>"));
background-position-x: right;
background-repeat: no-repeat;
background-size: contain;
@ -294,7 +294,7 @@ a {
}
&::before {
color: color.adjust($color-border, $lightness: -10%);
color: $color-border-contrast-10;
}
&.done {
@ -454,7 +454,7 @@ a {
&-group {
.btn-toggle {
& {
background: $color-white;
background: $color-surface;
border: 1px solid $color-theme-secondary;
}
@ -487,31 +487,31 @@ a {
// Link buttons only exists with blue text color in bootstrap. Provide them for all colors.
&-text {
&-primary {
@include build-text-button($color-theme-brand);
@include build-text-button($color-theme-brand, $color-theme-brand-contrast-25, $color-theme-brand-focus);
}
&-secondary {
@include build-text-button($color-text-decent);
@include build-text-button($color-text-decent, $color-text-decent-contrast-25, $color-text-decent-focus);
}
&-danger {
@include build-text-button($color-theme-error);
@include build-text-button($color-theme-error, $color-theme-error-contrast-25, $color-theme-error-focus);
}
&-success {
@include build-text-button($color-theme-success);
@include build-text-button($color-theme-success, $color-theme-success-contrast-25, $color-theme-success-focus);
}
&-info {
@include build-text-button($color-theme-info);
@include build-text-button($color-theme-info, $color-theme-info-contrast-25, $color-theme-info-focus);
}
&-warning {
@include build-text-button($color-theme-warning);
@include build-text-button($color-theme-warning, $color-theme-warning-contrast-25, $color-theme-warning-focus);
}
&-secondary2 {
@include build-text-button($color-text);
@include build-text-button($color-text, $color-text-contrast-25, $color-text-focus);
}
}
@ -522,8 +522,8 @@ a {
&-dashed {
@include truncate-nowidth;
border-style: dashed;
border-color: color.adjust($color-theme-secondary, $lightness: -10%);
color: color.adjust($color-text-decent, $lightness: 20%);
border-color: $color-theme-secondary-contrast-10;
color: $color-text-decent-muted-20;
}
&-decent {
@ -555,7 +555,7 @@ a {
.btn-circle {
@include force-height(4rem);
@include force-width(4rem);
background-color: $color-white;
background-color: $color-surface;
border-radius: 100%;
border-color: $color-border;
margin-left: 2rem;
@ -566,7 +566,7 @@ a {
.btn-circle-sm {
@include force-height(1.5rem);
@include force-width(1.5rem);
background-color: $color-white;
background-color: $color-surface;
border-radius: 100%;
border-color: $color-border;
font-size: 60%;
@ -655,7 +655,7 @@ $icon-size: 4.5rem;
}
&-content {
@include box-shadow-outer(0, 8px, 16px, .3);
@include box-shadow-outer(0, 8px, 16px, $color-shadow-30);
border: 0;
border-radius: $border-radius;
max-height: 100%;
@ -681,7 +681,7 @@ $icon-size: 4.5rem;
}
&-tabs {
background-color: $color-white;
background-color: $color-surface;
border: 0;
border-bottom: 1px solid $color-border;
padding-bottom: 0;
@ -765,4 +765,34 @@ $icon-size: 4.5rem;
color: $input-disabled-color;
opacity: 1;
}
}
}
//
// Dark mode for components that use compile time colors in bootstrap.
//
[data-bs-theme='dark'] {
.btn-secondary {
--bs-btn-bg: #{$color-theme-secondary};
--bs-btn-border-color: #{$color-theme-secondary};
--bs-btn-color: #{$color-text};
--bs-btn-hover-bg: #{$color-theme-secondary-contrast-5};
--bs-btn-hover-border-color: #{$color-theme-secondary-contrast-5};
--bs-btn-hover-color: #{$color-title};
--bs-btn-active-bg: #{$color-theme-secondary-contrast-10};
--bs-btn-active-border-color: #{$color-theme-secondary-contrast-10};
--bs-btn-active-color: #{$color-title};
--bs-btn-disabled-bg: #{$color-theme-secondary};
--bs-btn-disabled-border-color: #{$color-theme-secondary};
}
.btn-outline-secondary {
--bs-btn-border-color: #{$color-input};
--bs-btn-hover-bg: #{$color-theme-secondary};
--bs-btn-hover-border-color: #{$color-theme-secondary};
--bs-btn-hover-color: #{$color-title};
--bs-btn-active-bg: #{$color-theme-secondary};
--bs-btn-active-border-color: #{$color-theme-secondary};
--bs-btn-active-color: #{$color-title};
--bs-btn-disabled-border-color: #{$color-input};
}
}

277
frontend/src/app/theme/_colors.scss

@ -0,0 +1,277 @@
@use 'sass:color';
@use 'sass:map';
@use 'sass:math';
@use 'sass:meta';
/* stylelint-disable */
// Changes the lightness in the opposite direction for dark themes (--sqx-shade: -1) to keep the contrast.
@function shade($color, $amount) {
@if meta.type-of($color) == 'color' {
@return color.adjust($color, $lightness: $amount);
}
@return unquote('hsl(from #{$color} h s calc(l + #{math.div($amount, 1%)} * var(--sqx-shade)))');
}
@function fade($color, $alpha) {
@if meta.type-of($color) == 'color' {
@return rgba($color, $alpha);
}
@return unquote('rgb(from #{$color} r g b / #{$alpha})');
}
// Colors that depend on the color scheme. They are exposed as CSS variables (see _themes.scss).
$theme-light: (
'background': #f5f6f9,
'surface': #fff,
'border': #dedfe3,
'border-light': #f5f6f9,
'border-lighter': color.adjust(#f5f6f9, $lightness: 1%),
'border-dark': #e7e8ea,
'border-darker': color.adjust(#dedfe3, $lightness: -15%),
'title': #000,
'text': #373a3c,
'text-decent': #41444c,
'code-background': #f5f7f9,
'code-text': #708090,
'theme-brand-light': #d9e8fc,
'theme-secondary': #e0e1e5,
'input': #e0e1e5,
'input-background': #fff,
'input-disabled': #eff1f4,
'input-placeholder': color.adjust(#41444c, $lightness: 20%),
'badge-success-background': #e4f6e6,
'badge-success-foreground': #42a54c,
'badge-warning-background': #ffe8cc,
'badge-warning-foreground': #d18c3e,
'badge-danger-background': #fce0e3,
'badge-danger-foreground': #e56471,
'badge-info-background': #d0f2fb,
'badge-info-foreground': #3bb1cc,
'badge-primary-background': #cce1ff,
'badge-primary-foreground': #4186e0,
'badge-secondary-background': #e6e6e6,
'badge-secondary-foreground': #555,
'hint-background': color.adjust(#3389ff, $lightness: 35%),
'shadow': rgb(0 0 0 / 20%),
'field-line': #c7cfd7,
'alert-light-background': #fcfeff,
'progress': #3d7dd5,
'progress-trail': #f4f4f4,
'diagram-start': #000,
'diagram-edge': #808080,
'diagram-text': #343434,
'diagram-text-stroke': #fff,
'chart-text': #666,
'chart-grid': rgba(0, 0, 0, .1),
'editor-base': #fff,
'editor-border': #dedfe3,
'editor-accent': #3389ff,
);
$theme-dark: (
'background': #16181c,
'surface': #1f2227,
'border': #363a42,
'border-light': #272a30,
'border-lighter': #25282e,
'border-dark': #2e3238,
'border-darker': #5a606b,
'title': #f3f4f6,
'text': #d6d9de,
'text-decent': #a9afb9,
'code-background': #25282e,
'code-text': #9fadbb,
'theme-brand-light': #1f3a5f,
'theme-secondary': #3a3f47,
'input': #3d424a,
'input-background': #1a1d21,
'input-disabled': #26292e,
'input-placeholder': #7d848f,
'badge-success-background': #173a28,
'badge-success-foreground': #5fd08a,
'badge-warning-background': #3d2e14,
'badge-warning-foreground': #f0b35a,
'badge-danger-background': #43202a,
'badge-danger-foreground': #f38a96,
'badge-info-background': #113a45,
'badge-info-foreground': #5dcde6,
'badge-primary-background': #1c3558,
'badge-primary-foreground': #75aeff,
'badge-secondary-background': #33373e,
'badge-secondary-foreground': #b9bfc8,
'hint-background': #1d3350,
'shadow': rgb(0 0 0 / 60%),
'field-line': #4a505a,
'alert-light-background': #1f2227,
'progress': #4f8fe8,
'progress-trail': #2e3238,
'diagram-start': #f3f4f6,
'diagram-edge': #7d848f,
'diagram-text': #d6d9de,
'diagram-text-stroke': #1f2227,
'chart-text': #a9afb9,
'chart-grid': rgba(255, 255, 255, .08),
'editor-base': #1f2227,
'editor-border': #363a42,
'editor-accent': #3389ff,
);
$color-background: var(--sqx-background);
$color-surface: var(--sqx-surface);
$color-border: var(--sqx-border);
$color-border-light: var(--sqx-border-light);
$color-border-lighter: var(--sqx-border-lighter);
$color-border-dark: var(--sqx-border-dark);
$color-border-darker: var(--sqx-border-darker);
$color-title: var(--sqx-title);
$color-text: var(--sqx-text);
$color-text-decent: var(--sqx-text-decent);
$color-tooltip: #1a2129;
$color-code-background: var(--sqx-code-background);
$color-code-text: var(--sqx-code-text);
$color-extern-github: #353535;
$color-extern-google: #d34836;
$color-extern-microsoft: #004185;
$color-extern-twitter: #1da1f2;
$color-extern-oidc: #526484;
$color-theme-brand: #3389ff;
$color-theme-brand-dark: #3284f4;
$color-theme-brand-darker: #2f7deb;
$color-theme-brand-light: var(--sqx-theme-brand-light);
$color-theme-secondary: var(--sqx-theme-secondary);
$color-theme-error: #eb3142;
$color-theme-error-dark: #c00;
$color-theme-info: #0eafcc;
$color-theme-success-dark: #38a678;
$color-theme-success: #3ab480;
$color-theme-warning-dark: #a65b00;
$color-theme-warning: #ffb136;
$color-black: #000;
$color-white: #fff;
$color-input: var(--sqx-input);
$color-input-background: var(--sqx-input-background);
$color-input-disabled: var(--sqx-input-disabled);
$color-input-placeholder: var(--sqx-input-placeholder);
$color-input-shortcut: rgba(255, 255, 255, .2);
$color-badge-success-background: var(--sqx-badge-success-background);
$color-badge-success-foreground: var(--sqx-badge-success-foreground);
$color-badge-warning-background: var(--sqx-badge-warning-background);
$color-badge-warning-foreground: var(--sqx-badge-warning-foreground);
$color-badge-danger-background: var(--sqx-badge-danger-background);
$color-badge-danger-foreground: var(--sqx-badge-danger-foreground);
$color-badge-info-background: var(--sqx-badge-info-background);
$color-badge-info-foreground: var(--sqx-badge-info-foreground);
$color-badge-primary-background: var(--sqx-badge-primary-background);
$color-badge-primary-foreground: var(--sqx-badge-primary-foreground);
$color-badge-secondary-background: var(--sqx-badge-secondary-background);
$color-badge-secondary-foreground: var(--sqx-badge-secondary-foreground);
$color-hint-background: var(--sqx-hint-background);
$color-shadow: var(--sqx-shadow);
$color-field-line: var(--sqx-field-line);
$color-alert-light-background: var(--sqx-alert-light-background);
// Shadows and overlays.
$color-input-shadow: rgb(0 0 0 / 8%);
$color-overlay: rgba(0, 0, 0, 30%);
$color-overlay-dark: rgba(0, 0, 0, 50%);
// Special colors for single components.
$color-dark-onboarding: #273039;
$color-breadcrumb-arrow: #e4e7e9;
$color-graphql-hover: rgba(59, 75, 104, 7%);
$color-notifo-link: rgba(0, 0, 0, 55%);
$color-stars: #ffd700;
$color-tag-focus: #b3d3ff;
$color-tag-focus-shadow: rgba(51, 137, 255, 25%);
// Script logs are always shown as dark console.
$color-console-background: #1e1f22;
$color-console-text: #d4d4d4;
$color-console-muted: #7f848e;
$color-console-info: #4fc1ff;
$color-console-warn: #e5c07b;
$color-console-error: #f48771;
// Shadows with different strength.
$color-shadow-10: rgba(0, 0, 0, .1);
$color-shadow-13: rgba(0, 0, 0, .13);
$color-shadow-20: rgba(0, 0, 0, .2);
$color-shadow-30: rgba(0, 0, 0, .3);
// Computed colors. "contrast" moves away from the background (darker in light mode), "muted" moves towards it.
$color-background-muted-2: shade($color-background, 2%);
$color-border-contrast-5: shade($color-border, -5%);
$color-border-contrast-10: shade($color-border, -10%);
$color-border-contrast-30: shade($color-border, -30%);
$color-border-contrast-40: shade($color-border, -40%);
$color-border-muted-2: shade($color-border, 2%);
$color-border-muted-6: shade($color-border, 6%);
$color-border-dark-contrast-30: shade($color-border-dark, -30%);
$color-border-dark-contrast-40: shade($color-border-dark, -40%);
$color-border-darker-contrast-10: shade($color-border-darker, -10%);
$color-text-contrast-20: shade($color-text, -20%);
$color-text-contrast-50: shade($color-text, -50%);
$color-text-muted-20: shade($color-text, 20%);
$color-text-decent-muted-20: shade($color-text-decent, 20%);
$color-text-decent-muted-40: shade($color-text-decent, 40%);
$color-input-contrast-2: shade($color-input, -2%);
$color-input-contrast-10: shade($color-input, -10%);
$color-input-muted-5: shade($color-input, 5%);
$color-theme-secondary-contrast-5: shade($color-theme-secondary, -5%);
$color-theme-secondary-contrast-10: shade($color-theme-secondary, -10%);
$color-theme-secondary-contrast-20: shade($color-theme-secondary, -20%);
$color-theme-error-contrast-10: shade($color-theme-error, -10%);
$color-theme-error-muted-20: shade($color-theme-error, 20%);
$color-white-contrast-10: shade($color-white, -10%);
// Hover and focus colors for text buttons.
$color-theme-brand-contrast-25: shade($color-theme-brand, -25%);
$color-theme-brand-focus: fade($color-theme-brand, .5);
$color-theme-error-contrast-25: shade($color-theme-error, -25%);
$color-theme-error-focus: fade($color-theme-error, .5);
$color-theme-info-contrast-25: shade($color-theme-info, -25%);
$color-theme-info-focus: fade($color-theme-info, .5);
$color-theme-success-contrast-25: shade($color-theme-success, -25%);
$color-theme-success-focus: fade($color-theme-success, .5);
$color-theme-warning-contrast-25: shade($color-theme-warning, -25%);
$color-theme-warning-focus: fade($color-theme-warning, .5);
$color-text-contrast-25: shade($color-text, -25%);
$color-text-focus: fade($color-text, .5);
$color-text-decent-contrast-25: shade($color-text-decent, -25%);
$color-text-decent-focus: fade($color-text-decent, .5);
// Raw values for bootstrap and GraphiQL, which cannot work with CSS variables.
$color-raw-light-background: map.get($theme-light, 'background');
$color-raw-light-text: map.get($theme-light, 'text');
$color-raw-light-text-decent: map.get($theme-light, 'text-decent');
$color-raw-light-theme-secondary: map.get($theme-light, 'theme-secondary');
$color-raw-dark-background: map.get($theme-dark, 'background');
$color-raw-dark-border: map.get($theme-dark, 'border');
$color-raw-dark-border-light: map.get($theme-dark, 'border-light');
$color-raw-dark-surface: map.get($theme-dark, 'surface');
$color-raw-dark-text: map.get($theme-dark, 'text');
$color-raw-dark-text-decent: map.get($theme-dark, 'text-decent');
$color-raw-dark-title: map.get($theme-dark, 'title');

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save