├── assets
├── icon16.png
├── icon32.png
├── icon48.png
└── icon128.png
├── manifest.json
├── LICENSE
├── options
├── options.html
└── options.js
├── popup
├── popup.html
├── popup.css
└── popup.js
├── README.md
├── content_scripts
└── content.js
├── TODO.md
└── background
└── service-worker.js
/assets/icon16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/majidmanzarpour/vibe-styler/HEAD/assets/icon16.png
--------------------------------------------------------------------------------
/assets/icon32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/majidmanzarpour/vibe-styler/HEAD/assets/icon32.png
--------------------------------------------------------------------------------
/assets/icon48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/majidmanzarpour/vibe-styler/HEAD/assets/icon48.png
--------------------------------------------------------------------------------
/assets/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/majidmanzarpour/vibe-styler/HEAD/assets/icon128.png
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "name": "Vibe Styler",
4 | "version": "1.0.1",
5 | "description": "Change page styles using AI prompts.",
6 | "action": {
7 | "default_popup": "popup/popup.html",
8 | "default_icon": {
9 | "16": "assets/icon16.png",
10 | "32": "assets/icon32.png",
11 | "48": "assets/icon48.png"
12 | }
13 | },
14 | "background": {
15 | "service_worker": "background/service-worker.js"
16 | },
17 | "permissions": [
18 | "activeTab",
19 | "scripting",
20 | "storage",
21 | "webNavigation"
22 | ],
23 | "host_permissions": [
24 | "http://*/*",
25 | "https://*/*"
26 | ],
27 | "options_page": "options/options.html",
28 | "icons": {
29 | "16": "assets/icon16.png",
30 | "32": "assets/icon32.png",
31 | "48": "assets/icon48.png",
32 | "128": "assets/icon128.png"
33 | }
34 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Majid Manzarpour
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/options/options.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Vibe Styler Options
5 |
30 |
31 |
32 |
Vibe Styler Options
33 |
34 |
Gemini API Key
35 |
Enter your Google AI Studio Gemini API Key. This key will be stored securely using Chrome storage.
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Vibe Styler Chrome Extension
2 |
3 | Change the style of any webpage using AI prompts with the power of Gemini 2.5 Pro!
4 |
5 | Demo: https://x.com/majidmanzarpour/status/1907275311798206561
6 |
7 | This Chrome extension allows you to:
8 | * Enter a text prompt describing the style changes you want (e.g., "make the background dark blue and text light gray", "apply a cyberpunk theme", "use Star Wars inspired colors and fonts").
9 | * Utilize the **Google Gemini 2.5 Pro model** with its large context window to analyze the entire page structure and existing styles for more accurate and context-aware results.
10 | * Get creative CSS generated for specific requests or broad themes.
11 | * Apply the generated styles to the current page.
12 | * Automatically re-apply your saved styles when you revisit a page.
13 | * Manage saved styles through the extension's options page.
14 |
15 | ## Development Setup
16 |
17 | 1. Clone this repository.
18 | 2. Open Google Chrome and navigate to `chrome://extensions`.
19 | 3. Enable "Developer mode" (usually a toggle in the top right).
20 | 4. Click "Load unpacked".
21 | 5. Select the directory where you cloned the repository.
22 | 6. The Vibe Styler extension icon should appear in your toolbar.
23 |
24 | ## Usage
25 |
26 | 1. **Set API Key:**
27 | * Right-click the Vibe Styler icon in your toolbar and choose "Options" (or find the extension on the `chrome://extensions` page and click "Details" -> "Extension options").
28 | * Obtain an API key for Gemini from Google AI Studio ([https://aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey)). Ensure the key is enabled for the Gemini API (specifically the model used, currently an experimental Gemini 2.5 Pro).
29 | * Paste the API key into the input field on the Options page and click "Save Key".
30 | 2. **Apply Styles:**
31 | * Navigate to the webpage you want to modify.
32 | * Click the Vibe Styler icon in your toolbar to open the popup.
33 | * Enter your desired style changes in the text area. Be specific or try a theme!
34 | * Click "Apply Styles".
35 | * Wait for the AI (Gemini 2.5 Pro) to process and inject the styles. The status message will update.
36 | 3. **Revert Styles:**
37 | * Click "Revert Styles" in the popup to temporarily remove styles applied during the current session on that page.
38 | 4. **Persistence:**
39 | * Styles are automatically saved when successfully applied.
40 | * When you reload or revisit a page, any saved styles for that specific URL will be automatically reapplied.
41 | 5. **Manage Styles:**
42 | * Go to the Options page to view all saved styles.
43 | * You can delete styles for individual pages or clear all saved styles.
44 |
45 | ## Important Notes
46 |
47 | * **Permissions:** This extension requires permission to "Read and change all your data on all websites" (`host_permissions`) to automatically apply saved styles on page load. It also uses the `webNavigation` permission to detect when pages finish loading.
48 | * **Privacy:** This extension sends the full HTML structure (body) and CSS (internal styles and links) of the current page to the Google Gemini API, along with your prompt and API key, to generate new styles. Consider the privacy implications for sensitive pages.
49 | * **AI Model:** Uses Gemini 2.5 Pro (experimental model `gemini-2.5-pro-exp-03-25`). Results depend on the AI's capabilities and the clarity/interpretability of your prompt.
50 | * **Limitations:** Complex websites or those with strict Content Security Policies (CSPs) might interfere with style injection. Very large pages might still approach API context limits, though this is less likely with 1M tokens.
51 | * **API Key:** Requires a valid Google Gemini API key with the appropriate API enabled.
52 |
--------------------------------------------------------------------------------
/content_scripts/content.js:
--------------------------------------------------------------------------------
1 | console.log(
2 | "[ContentScript] Script start execution for:",
3 | window.location.href
4 | );
5 |
6 | try {
7 | // Listener for messages from the background script
8 | console.log("[ContentScript] Setting up message listener...");
9 | chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
10 | console.log("[ContentScript] Message received:", request);
11 |
12 | if (request.type === "INJECT_CSS") {
13 | console.log("Received CSS to inject:", request.css);
14 | const cssToInject = request.css;
15 | const styleId = "vibe-styler-injected-styles";
16 |
17 | // Find existing style tag added by this extension, or create a new one
18 | let styleElement = document.getElementById(styleId);
19 | if (!styleElement) {
20 | styleElement = document.createElement("style");
21 | styleElement.id = styleId;
22 | // Append to for clarity
23 | (document.head || document.documentElement).appendChild(styleElement);
24 | console.log("Created new style tag.");
25 | } else {
26 | console.log("Found existing style tag.");
27 | }
28 |
29 | // Inject the CSS
30 | styleElement.textContent = cssToInject;
31 | console.log(`Injected ${cssToInject.length} characters of CSS.`);
32 |
33 | sendResponse({ status: "CSS injected successfully." });
34 | console.log("[ContentScript] Handled INJECT_CSS.");
35 | } else if (request.type === "REMOVE_STYLES") {
36 | console.log("Request received to remove injected styles.");
37 | const styleId = "vibe-styler-injected-styles";
38 | const styleElement = document.getElementById(styleId);
39 | if (styleElement) {
40 | styleElement.remove();
41 | console.log("Removed injected style tag.");
42 | sendResponse({ status: "Styles removed successfully." });
43 | console.log("[ContentScript] Handled REMOVE_STYLES.");
44 | } else {
45 | console.log("No injected style tag found to remove.");
46 | sendResponse({ status: "No styles to remove." });
47 | }
48 | } else if (request.type === "EXTRACT_CONTENT") {
49 | console.log("Request received to extract content.");
50 | // Phase 2 Content Extraction Logic
51 | const htmlContent = document.body.outerHTML;
52 | console.log(
53 | `Extracted HTML content (${(htmlContent.length / 1024).toFixed(2)} KB)`
54 | );
55 |
56 | // --- Extract CSS ---
57 | let extractedCss = "";
58 | try {
59 | // 1. Get all