Skip to content

Commit

Permalink
collection accent colour
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Feb 6, 2024
1 parent 83dbe28 commit 4adadd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/v2/db/schema/collections/user-collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { generateID } from "@/v2/lib/oslo"
import { createInsertSchema, createSelectSchema } from "drizzle-zod"
import { userCollectionLikes } from "./user-collection-likes"
import { userCollectionCollaborators } from "./user-collections-collaborators"
import type { ColourType } from "@/v2/lib/colour"

/*
NOTE: this file is where users store their collections of assets.
Expand Down Expand Up @@ -42,6 +43,7 @@ export const userCollection = sqliteTable(
.$defaultFn(() => {
return new Date().toISOString()
}),
accentColour: text("accent_colour").$type<ColourType>(),
isPublic: integer("is_public", { mode: "boolean" })
.default(false)
.notNull(),
Expand Down
5 changes: 5 additions & 0 deletions src/v2/lib/colour.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type ColourType = `#${string}`

export function isValidColour(colour: string): colour is ColourType {
return /^#[0-9A-F]{6}$/i.test(colour)
}

0 comments on commit 4adadd3

Please sign in to comment.