What Is the Purpose of the style-library.json File in Awesome GPT Image 2?
The style-library.json file acts as the central metadata catalogue and semantic backbone for the Awesome GPT Image 2 project, storing the complete taxonomy that drives prompt generation, template rendering, and UI component selection.
Located in the freestylefly/awesome-gpt-image-2 repository, the style-library.json file consolidates bilingual metadata, style definitions, and template configurations into a single source of truth. This JSON structure enables the project to dynamically generate documentation, populate UI selectors, and construct AI prompts without hard-coding values across multiple files.
Core Taxonomy Components
The style-library.json file organizes the project's domain model into six primary sections. Each section uses consistent multilingual keys (English and Chinese) to support internationalized workflows.
Bilingual Tag Labels
The tag labels provide human-readable identifiers for content classification. These tags—including entries like Art, Campaign, and Chart—supply both English and Chinese translations. UI components reference these tags to group generated images by subject matter, ensuring consistent labeling across the interface.
Hierarchical Categories
Categories partition the library into high-level domains such as UI & Interfaces, Charts & Infographics, and Products & E-commerce. Each category object contains:
- A unique identifier (
id) - A short value string
- A cover image path
- Multilingual titles and descriptions (
title.en,title.zh,description.en,description.zh)
Visual Style Definitions
The styles array enumerates distinct visual aesthetics such as 3D, Brand, Illustration, and Poster. Each style entry includes an optional keywords array that maps user intent to concrete visual cues, allowing the prompt engine to inject specific stylistic modifiers into generated instructions.
Contextual Scenes
Scenes describe usage contexts and target audiences, including Tech, Commerce, Education, and Social. These qualifiers help the prompt-generation logic tailor outputs to specific application domains without requiring manual reconfiguration.
Prompt Templates
The templates section catalogs ready-made prompt systems like UI Screenshot System, Infographic Engine, and Poster Layout System. Every template object links to applicable categories, styles, and scenes, and includes:
- Multilingual guidance arrays (
guidance.en,guidance.zh) - Common pitfalls to avoid
- Reference case IDs demonstrating expected output quality
Version and Repository Metadata
The root object stores a version string and a repository URL for traceability. This ensures that consuming code can validate schema compatibility and locate the source documentation.
Consuming the JSON in TypeScript
The project imports data/style-library.json directly into TypeScript modules to drive UI logic and prompt construction. The following patterns demonstrate typical consumption strategies.
Retrieve all available style identifiers for a selector component:
import styleLib from './data/style-library.json' assert { type: 'json' };
export const getAllStyleIds = (): string[] =>
styleLib.styles.map((s: any) => s.id);
Build a dropdown menu of categories using English titles and descriptions:
export const categoryOptions = styleLib.categories.map((c: any) => ({
value: c.id,
label: c.title.en,
description: c.description.en,
cover: c.cover,
}));
Resolve template-specific guidance for display in the user interface:
export const getTemplateGuidance = (templateId: string) => {
const tmpl = styleLib.templates.find((t: any) => t.id === templateId);
return tmpl ? tmpl.guidance.en : [];
};
File Location and Ecosystem Integration
The style-library.json file resides at data/style-library.json in the repository root. Downstream documentation such as docs/templates.md derives its content from the templates section of this JSON, ensuring that human-readable guides remain synchronized with the underlying data structure. Utility modules like src/lib/style.ts import this JSON to expose typed helper functions for React components or prompt builders.
Summary
- The
style-library.jsonfile serves as the single source of truth for the Awesome GPT Image 2 taxonomy, consolidating tags, categories, styles, scenes, and templates into one JSON structure. - It provides bilingual metadata (English and Chinese) to support internationalized prompt generation and UI rendering.
- The file enables data-driven workflows by allowing TypeScript modules to import structured metadata directly, eliminating hard-coded values.
- Template objects contain rich contextual data including guidance, pitfalls, and example case IDs to standardize AI image generation workflows.
- Located at
data/style-library.json, the catalogue connects documentation, UI components, and prompt engines through a unified schema.
Frequently Asked Questions
What data structure does style-library.json use?
The file follows a flat JSON schema with five primary array properties (tags, categories, styles, scenes, templates) and root-level metadata for version and repository linkage. Each array contains objects with consistent id fields and multilingual string mappings (.en and .zh suffixes) to support bilingual rendering.
How does the repository handle multilingual support?
All human-readable strings in style-library.json implement a nested object pattern with en and zh keys. TypeScript consuming code accesses the desired language by dereferencing these properties (e.g., category.title.en), allowing the same JSON structure to drive both English and Chinese interface versions without duplication.
Where is style-library.json located in the project structure?
The file is located at data/style-library.json relative to the repository root. This central location allows both documentation generators (like those producing docs/templates.md) and application code to import the taxonomy using relative paths such as ../data/style-library.json or direct import assertions.
How do templates reference other taxonomy elements?
Each template object in the templates array contains foreign-key references via identifier strings, linking to category, style, and scene entries defined elsewhere in the JSON. This relational structure allows the prompt engine to resolve complete contextual metadata when rendering a specific template, ensuring visual consistency and domain appropriateness.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →