Skip to content

Commit

Permalink
fix: automatically calculate the accent and primary color for apidocs…
Browse files Browse the repository at this point in the history
…, fix text color
  • Loading branch information
MiniDigger committed Jan 5, 2024
1 parent 3d60c09 commit 2f7634b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions frontend/src/components/ApiDocs.client.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import "rapidoc";
import { ref, watch } from "vue";
import { computed, ref, watch } from "vue";
import { useSettingsStore } from "~/store/useSettingsStore";
const settings = useSettingsStore();
Expand All @@ -20,9 +20,11 @@ watch(dom, () => {
}
});
});
const bgColor = computed(() => window.getComputedStyle(document.body).getPropertyValue(settings.darkMode ? "--gray-800" : "--gray-50"));
const primaryColor = computed(() => window.getComputedStyle(document.body).getPropertyValue("--primary-500"));
</script>

<!-- todo colors as custom props + we need to change other colors (to accent color) -->
<template>
<rapi-doc
ref="dom"
Expand All @@ -42,9 +44,10 @@ watch(dom, () => {
heading-text="Hangar API"
:theme="settings.darkMode ? 'dark' : 'light'"
font-size="large"
:bg-color="settings.darkMode ? 'var(--gray-800)' : 'var(--gray-50)'"
primary-color="var(--primary-500)"
:bg-color="bgColor"
:primary-color="primaryColor"
regular-font="inherit"
:text-color="settings.darkMode ? '#E0E6f0' : '#262626'"
>
</rapi-doc>
</template>
Expand Down

0 comments on commit 2f7634b

Please sign in to comment.