Files
linkedin-carousel-generator/linkedin_carousel_app/styles.py
Nicola Malizia 2f2d5ed486 FIRST
2026-02-24 15:30:25 +01:00

81 lines
4.9 KiB
Python

from pydantic import BaseModel, Field
from typing import List
# --- Data Models (Structured Output from Gemini) ---
class Slide(BaseModel):
headline: str = Field(description="Catchy headline for the slide (max 10 words).")
body: str = Field(description="Concise body text for the slide (max 30 words).")
code_snippet: str | None = Field(description="Optional: A very short, relevant code snippet (max 5-8 lines). Use only if it adds value to the slide.")
source_image_url: str | None = Field(description="Optional: A URL to an image mentioned in the source text that should be integrated into this slide's visual.")
image_prompt: str = Field(description="Detailed prompt for generating the background image based on the style.")
class CarouselContent(BaseModel):
slides: List[Slide] = Field(description="List of 5-7 slides for the carousel.")
post_text: str = Field(description="Engaging LinkedIn post text to accompany the carousel, including hashtags.")
# --- Visual Styles ---
STYLES = {
"Minimalist Tech": {
"description": "Clean, white background, dark text, geometric shapes.",
"bg_prompt_suffix": "minimalist, clean white background, subtle geometric tech patterns, high key lighting, 8k resolution, uncluttered.",
"text_color": (30, 30, 30), # Dark Grey
"overlay_color": (255, 255, 255, 220), # White with transparency
},
"Bold Corporate": {
"description": "Strong blue background, white text, professional look.",
"bg_prompt_suffix": "corporate professional background, deep blue gradients, abstract business concepts, subtle network connections, 8k resolution.",
"text_color": (255, 255, 255), # White
"overlay_color": (0, 50, 100, 200), # Blue with transparency
},
"Creative Vibrant": {
"description": "Colorful gradients, artistic, modern.",
"bg_prompt_suffix": "vibrant artistic background, fluid color gradients, abstract art, creative energy, 8k resolution, soft lighting.",
"text_color": (255, 255, 255), # White
"overlay_color": (0, 0, 0, 150), # Black with transparency
},
"Nature Serene": {
"description": "Calm, nature-inspired, green tones.",
"bg_prompt_suffix": "serene nature background, soft green leaves, organic shapes, calm atmosphere, natural light, 8k resolution.",
"text_color": (20, 50, 20), # Dark Green
"overlay_color": (240, 255, 240, 200), # Light Green/White with transparency
},
"Hand-Drawn Doodle": {
"description": "Playful, sketch-style, white background with black ink drawings.",
"bg_prompt_suffix": "hand-drawn doodle style, sketch, pencil on white paper, playful, creative, simple line art, black ink on white background.",
"text_color": (0, 0, 0), # Black
"overlay_color": (255, 255, 255, 240), # White with transparency
},
"Playful Color Doodle": {
"description": "Fun, hand-drawn sketches with vibrant pops of color.",
"bg_prompt_suffix": "colorful hand-drawn doodle style, marker drawings, watercolor splashes, vibrant accents, creative, white background, playful illustrations.",
"text_color": (30, 30, 30), # Dark Grey
"overlay_color": (255, 255, 255, 230), # White with transparency
},
"Reference-Based": {
"description": "Uses your uploaded image to define the style. Predefined settings are ignored.",
"bg_prompt_suffix": "match the provided reference image style perfectly.",
"text_color": (255, 255, 255), # Default white (will be used for footer)
"overlay_color": (0, 0, 0, 0), # No overlay
},
"Tech Color Doodle": {
"description": "Hand-drawn technical sketches with neon tech accents.",
"bg_prompt_suffix": "tech doodle style, hand-drawn circuits, network nodes, code symbols, cloud infrastructure sketches, neon blue and cyan marker accents, clean white background, modern tech aesthetic.",
"text_color": (30, 30, 30), # Dark Grey
"overlay_color": (255, 255, 255, 240), # White with transparency
},
"Excalidraw Light": {
"description": "Clean, hand-drawn diagram style on a white background, like Excalidraw.",
"bg_prompt_suffix": "excalidraw style, hand-drawn diagram, sketchy black lines on clean white background, rough strokes, architectural sketch, minimalist, technical drawing aesthetic, high contrast.",
"text_color": (20, 20, 20), # Almost Black
"overlay_color": (255, 255, 255, 230), # White with transparency
},
"Excalidraw Dark": {
"description": "Dark mode hand-drawn diagram style, white lines on dark grey.",
"bg_prompt_suffix": "excalidraw dark mode style, hand-drawn diagram, sketchy white lines on dark grey background (#121212), rough strokes, architectural sketch, minimalist, technical drawing aesthetic, high contrast.",
"text_color": (240, 240, 240), # Off-White
"overlay_color": (30, 30, 30, 200), # Dark Grey with transparency
}
}