Skip to content

Commit

Permalink
Merge branch 'master' into fix/custom-reply-drag
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAnotherID committed May 27, 2024
2 parents e10e4c7 + ce701c6 commit cf66777
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/components/mod/PageStory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import { ElMessage, ElMessageBox } from 'element-plus'
import StoryBackup from "~/components/mod/story/StoryBackup.vue";
import * as twColors from 'tailwindcss/colors'
import randomColor from "randomcolor";
interface Log {
Expand Down Expand Up @@ -252,12 +253,41 @@ function closeItem() {
users.value = {}
}
const randomColorWithIndex = (i: number): string => {
const presets = [
twColors.red[600],
twColors.orange[600],
twColors.yellow[600],
twColors.green[600],
twColors.cyan[600],
twColors.blue[600],
twColors.purple[600],
twColors.pink[600],
twColors.slate[600],
]
const randomColorSystems = [
'red',
'orange',
'yellow',
'green',
'blue',
'purple',
'pink',
'monochrome',
]
if (i < presets.length) {
return presets[i]
} else {
return randomColor({ hue: randomColorSystems[i % randomColorSystems.length], luminosity: 'dark' })
}
}
const items = computed(() => {
let items: Item[] = []
item_data.value.forEach(v => {
item_data.value.forEach((v, i) => {
if (!users.value[v.IMUserId]) {
users.value[v.IMUserId] = [
randomColor(),
randomColorWithIndex(i),
v.nickname
]
}
Expand Down

0 comments on commit cf66777

Please sign in to comment.