Skip to content

Commit b9d677f

Browse files
committed
feat: improve color boxes position in code highlighter
1 parent 365d72e commit b9d677f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/themes/code/CssColorize.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@ const lines = computed(() => code.split("\n"));
2727
<span class="text-[#94e2d5]">
2828
{{ ":" }}
2929
</span>
30+
<!-- Property value -->
3031
<span class="text-[#fab387]">
3132
{{ line.split(":")[1].split(";")[0] }}
3233
</span>
3334
<span>
3435
{{ ";" }}
3536
</span>
37+
<span
38+
v-if="line.split(':')[1].split(';')[0].startsWith(' #')"
39+
class="ml-2 inline-block size-3 border align-sub"
40+
:style="{ background: line.split(':')[1].split(';')[0] }"
41+
></span>
3642
</template>
3743
<!-- Selectors properties end -->
3844
<span v-else-if="line === '}'" class="text-[#f38ba8]">

src/components/themes/code/JsonColorize.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const parsed = computed((): {
6868
<span v-if="index !== Object.keys(parsed.colors).length - 1">
6969
{{ "," }}
7070
</span>
71-
<span v-if="typeof value === 'string'" class="inline-block size-3 border ml-2" :style="{ background: value }" />
71+
<span v-if="typeof value === 'string'" class="ml-2 inline-block size-3 border align-sub" :style="{ background: value }" />
7272
</div>
7373
<div class="whitespace-pre-wrap">
7474
<span class="text-[#fab370]">

0 commit comments

Comments
 (0)