Documentation
¶
Index ¶
- Variables
- func ColorClassToName(colorClass string) string
- func ColorNameToClass(colorName string) string
- func ConvertIDsToNames(ctx context.Context, tagIDs map[string]bool, ...) ([]string, error)
- func GenerateColor(tagName string) string
- func MergeTagIDs(existingTags, newTags []string) []string
- func MergeTags(existingTags, newTags []string) []string
- func NewID() string
- func NewTagIDsMap(tagIDs []string) map[string]bool
- func TagIDsMapToSlice(tagIDs map[string]bool) []string
- type IDSet
- type Metadatadeprecated
- type Set
- type Tag
Constants ¶
This section is empty.
Variables ¶
var ChipColors = []string{
"bg-red-100 text-red-800",
"bg-orange-100 text-orange-800",
"bg-amber-100 text-amber-800",
"bg-yellow-100 text-yellow-800",
"bg-lime-100 text-lime-800",
"bg-green-100 text-green-800",
"bg-emerald-100 text-emerald-800",
"bg-teal-100 text-teal-800",
"bg-cyan-100 text-cyan-800",
"bg-sky-100 text-sky-800",
"bg-blue-100 text-blue-800",
"bg-indigo-100 text-indigo-800",
"bg-violet-100 text-violet-800",
"bg-purple-100 text-purple-800",
"bg-fuchsia-100 text-fuchsia-800",
"bg-pink-100 text-pink-800",
"bg-rose-100 text-rose-800",
"bg-slate-100 text-slate-800",
"bg-gray-100 text-gray-800",
"bg-zinc-100 text-zinc-800",
}
ChipColors contains predefined colors suitable for chips/badges
var ColorNames = []string{
"red",
"orange",
"amber",
"yellow",
"lime",
"green",
"emerald",
"teal",
"cyan",
"sky",
"blue",
"indigo",
"violet",
"purple",
"fuchsia",
"pink",
"rose",
"slate",
"gray",
"zinc",
}
ColorNames provides user-friendly color names corresponding to ChipColors
Functions ¶
func ColorClassToName ¶
ColorClassToName converts a Tailwind color class to a user-friendly name
func ColorNameToClass ¶
ColorNameToClass converts a user-friendly color name to a Tailwind color class
func ConvertIDsToNames ¶
func ConvertIDsToNames(ctx context.Context, tagIDs map[string]bool, tagGetter func(context.Context, []string) ([]*Tag, error)) ([]string, error)
ConvertIDsToNames converts tag IDs to tag names using the provided getter function
func GenerateColor ¶
GenerateColor generates a deterministic color for a tag name Uses FNV-1a hash to ensure same tag names always get the same color
func MergeTagIDs ¶
MergeTagIDs merges two slices of tag IDs, removing duplicates
func NewTagIDsMap ¶
NewTagIDsMap creates a new tag IDs map from a slice
func TagIDsMapToSlice ¶
TagIDsMapToSlice converts tag IDs map to slice
Types ¶
type IDSet ¶
IDSet represents a set of tag IDs using map for O(1) operations
type Metadata
deprecated
type Tag ¶
type Tag struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Color string `json:"color"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by,omitempty"`
}
Tag represents a tag entity with ID-based management