You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -5,20 +5,20 @@ Agregore provides CSS variables for themeing the browser at the URL `agregore://
5
5
The contents of this look something like:
6
6
7
7
```css
8
-
:root {
9
-
--ag-color-purple: #6e2de5;
10
-
--ag-color-black: #111;
11
-
--ag-color-white: #F2F2F2;
12
-
--ag-color-green: #2de56e;
13
-
}
14
-
15
-
:root {
16
-
--ag-theme-font-family: system-ui;
17
-
--ag-theme-background: var(--ag-color-black);
18
-
--ag-theme-text: var(--ag-color-white);
19
-
--ag-theme-primary: var(--ag-color-purple);
20
-
--ag-theme-secondary: var(--ag-color-green);
21
-
}
8
+
:root {
9
+
--ag-color-purple: #6e2de5;
10
+
--ag-color-black: #111;
11
+
--ag-color-white: #f2f2f2;
12
+
--ag-color-green: #2de56e;
13
+
}
14
+
15
+
:root {
16
+
--ag-theme-font-family: system-ui;
17
+
--ag-theme-background: var(--ag-color-black);
18
+
--ag-theme-text: var(--ag-color-white);
19
+
--ag-theme-primary: var(--ag-color-purple);
20
+
--ag-theme-secondary: var(--ag-color-green);
21
+
}
22
22
```
23
23
24
24
These can be imported anywhere you'd like to use browser styling.
@@ -51,11 +51,107 @@ You can replace the various values with any valid CSS values like Hex codes: `#F
51
51
52
52
More styles will be added here as needed. If you feel we should standardize on some sort of style, feel free to open an issue talking about what it is and why it should be added.
53
53
54
-
### Highlight.js
54
+
## Syntax Highlighting Font
55
+
56
+
Agregore now uses a custom font for syntax highlighting in code blocks. The font file is located at `browser://theme/FontWithASyntaxHighlighter-Regular.woff2`.
57
+
58
+
To use this font for `code` elements, you can include the following CSS in your stylesheet:
This font provides built-in syntax highlighting for code blocks, making it easier to read and understand code snippets.
72
+
73
+
## Theme Protocol (`browser://theme/`)
74
+
75
+
### Overview
76
+
77
+
The `browser://theme/` protocol provides a standardized way for web applications to access browser-level CSS styles and theme variables in Agregore and other compatible browsers, such as [Peersky](https://peersky.p2plabs.xyz/). This protocol ensures consistent theming across different browsers by serving CSS files with a common set of variables. It allows developers to build applications that adapt to the browser's theme without needing browser-specific code, making it suitable for any browser that implements the protocol.
78
+
79
+
## Purpose
80
+
81
+
The goal of the `browser://theme/` protocol is to:
82
+
83
+
- Enable cross-browser compatibility for theming in any browser, including p2p browsers like Peersky and Agregore.
84
+
- Provide a unified set of theme variables using standardized `--browser-theme-` prefixes.
85
+
- Allow web applications to import styles or variables without hardcoding browser-specific protocols (e.g., `peersky://` or `agregore://`).
86
+
87
+
## Implementation
88
+
89
+
### Protocol Handler
90
+
91
+
The `browser://theme/` protocol is implemented in Peersky via a custom Electron protocol handler (`theme-handler.js`). It serves CSS files from the `src/pages/theme/` directory when requests are made to URLs like `browser://theme/vars.css` or `browser://theme/base.css`.
55
92
56
-
For convenience, Agregore bundles highlight.js and a default theme for it.
93
+
-**Location**: Files are stored in `src/pages/theme/` (e.g., `vars.css`, `base.css`, `index.css`).
94
+
-**URL Structure**: Requests to `browser://theme/<filename>` map to `src/pages/theme/<filename>`.
You can load it up using `agregore://theme/highlight.js` and `agregore://theme/highlight.css`.
97
+
### Theme Variable Standardization
98
+
99
+
The `browser://theme/` protocol provides standardized theme variables prefixed with `--browser-theme-`, such as `--browser-theme-font-family`, `--browser-theme-background`, `--browser-theme-text-color`, `--browser-theme-primary-highlight`, and `--browser-theme-secondary-highlight`. These variables allow web applications to adapt to the host browser's theme without needing browser-specific code.
100
+
101
+
Each browser implements these standardized variables by mapping them to their internal theme variables. For example:
102
+
103
+
- In Peersky, `--browser-theme-background` is mapped to `--base01`, which is part of the Base16 color palette [Base16 Framework](https://github.com/chriskempson/base16).
104
+
- In Agregore, `--browser-theme-background` is mapped to `--ag-theme-background`, which is defined in Agregore's theme configuration.
105
+
106
+
This ensures that applications built for one browser can work seamlessly in another, as long as they use the standardized `--browser-theme-` variables.
107
+
108
+
### Cross-Browser Compatibility
109
+
110
+
The `browser://theme/` protocol enables apps built for one browser to work seamlessly in another by providing standardized theme variables prefixed with `--browser-theme-`. These variables are mapped to each browser's internal theme variables, ensuring consistent theming across different browsers.
111
+
112
+
For example:
113
+
114
+
- In Peersky, `--browser-theme-background` is mapped to `--base01`, which is part of the Base16 color palette.
115
+
- In Agregore, `--browser-theme-background` is mapped to `--ag-theme-background`, which is defined in Agregore's theme configuration.
116
+
117
+
As a result, an app using `--browser-theme-background` will render with the appropriate background color for each browser, whether it's based on Base16 (as in Peersky) or another theme system (as in Agregore).
118
+
119
+
Additionally, apps can use the full set of variables provided by each browser for more advanced theming, but for cross-browser compatibility, it's recommended to use the standardized `--browser-theme-` variables.
120
+
121
+
## Usage
122
+
123
+
### Importing Theme Styles
124
+
125
+
Web applications can import theme styles or variables using `<style>` tags or `<link>` elements. Examples:
0 commit comments