intent_styles
Overview
The intent_styles table stores per-user visual customizations for each of the 6 intent types. Users can personalize how their posts look when tagged with a specific intent, including colors, fonts, borders, and background styles.
Relevant Invariants
- Invariant #10: "Expressive Freedom Is Spatially Contained" -- Style customization is per-user, applied to their own content
Schema
-- Pre-existing table (inferred from frontend code)
CREATE TABLE intent_styles (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID REFERENCES auth.users(id) NOT NULL,
intent TEXT NOT NULL,
bg_color TEXT,
text_color TEXT,
border_color TEXT,
font_family TEXT,
font_size TEXT,
border_style TEXT,
border_width TEXT,
border_radius TEXT,
bg_gradient TEXT,
bg_pattern TEXT,
shadow TEXT,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(user_id, intent)
);
Columns
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | No | uuid_generate_v4() | Primary key |
user_id | uuid | No | -- | Style owner |
intent | text | No | -- | Intent key (e.g., thinking_out_loud) |
bg_color | text | Yes | -- | Background color CSS value |
text_color | text | Yes | -- | Text color CSS value |
border_color | text | Yes | -- | Border color CSS value |
font_family | text | Yes | -- | Font family CSS value |
font_size | text | Yes | -- | Font size CSS value |
border_style | text | Yes | -- | Border style (solid, dashed, etc.) |
border_width | text | Yes | -- | Border width CSS value |
border_radius | text | Yes | -- | Border radius CSS value |
bg_gradient | text | Yes | -- | CSS gradient for background |
bg_pattern | text | Yes | -- | Background pattern identifier |
shadow | text | Yes | -- | Box shadow CSS value |
created_at | timestamptz | No | NOW() | Creation timestamp |
updated_at | timestamptz | No | NOW() | Last update timestamp |
RLS Policies
-- SELECT: Anyone can read intent styles (needed to render other users' posts)
CREATE POLICY "Intent styles are publicly readable"
ON intent_styles FOR SELECT
USING (true);
-- INSERT/UPDATE: Users can only manage their own styles
CREATE POLICY "Users can upsert own intent styles"
ON intent_styles FOR ALL
USING (auth.uid() = user_id);
Related
Last updated: 2026-02-07