Skip to content

Commit e760520

Browse files
committed
docs
1 parent 84006e2 commit e760520

File tree

3 files changed

+130
-78
lines changed

3 files changed

+130
-78
lines changed

README.md

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -157,107 +157,47 @@ gh auth status
157157

158158
Configuration file location: `~/.config/gitfetch/gitfetch.conf`
159159

160-
The configuration file is automatically created on first run and contains two main sections:
160+
The configuration file is automatically created on first run. See `docs/providers.md` for detailed provider configuration and `docs/colors.md` for color customization options.
161161

162162
### [DEFAULT] Section
163163

164164
```ini
165165
[DEFAULT]
166166
username = yourusername
167167
cache_expiry_hours = 24
168+
provider = github
169+
provider_url = https://api.github.com
168170
```
169171

170-
- `username`: Your default GitHub username (automatically set from authenticated GitHub CLI user)
172+
- `username`: Your default username (automatically detected)
171173
- `cache_expiry_hours`: How long to keep cached data (default: 24 hours)
174+
- `provider`: Git hosting provider (github, gitlab, gitea, sourcehut)
175+
- `provider_url`: API URL for the provider
172176

173177
### [COLORS] Section
174178

175-
gitfetch supports extensive color customization. All colors use ANSI escape codes.
179+
gitfetch supports extensive color customization. All colors use ANSI escape codes. See `docs/colors.md` for detailed color configuration options.
176180

181+
````ini
177182
```ini
178183
[COLORS]
179184
reset = \033[0m
180185
bold = \033[1m
181-
dim = \033[2m
182-
red = \033[91m
183-
green = \033[92m
184-
yellow = \033[93m
185-
blue = \033[94m
186-
magenta = \033[95m
187-
cyan = \033[96m
188-
white = \033[97m
189-
orange = \033[38;2;255;165;0m
190-
accent = \033[1m
191-
header = \033[38;2;118;215;161m
192-
muted = \033[2m
193-
0 = \033[48;5;238m
194-
1 = \033[48;5;28m
195-
2 = \033[48;5;34m
196-
3 = \033[48;5;40m
197-
4 = \033[48;5;82m
198-
```
199-
200-
#### Color Reference
201-
202-
- **Text Styles**:
203-
204-
- `reset`: Reset all formatting
205-
- `bold`: Bold text
206-
- `dim`: Dimmed text
207-
- `accent`: Accent styling (bold)
208-
209-
- **Basic Colors**:
210-
211-
- `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`: Standard ANSI colors
212-
- `orange`: Custom orange color
186+
# ... color definitions ...
187+
````
213188

214-
- **UI Elements**:
189+
See `docs/colors.md` for detailed color configuration options and customization examples.
215190

216-
- `header`: Section headers and main display text
217-
- `muted`: Separators and underlines
191+
## Supported Providers
218192

219-
- **Contribution Graph**:
220-
- `0`: No contributions (lightest)
221-
- `1`: 1-2 contributions
222-
- `2`: 3-6 contributions
223-
- `3`: 7-12 contributions
224-
- `4`: 13+ contributions (darkest)
193+
gitfetch supports multiple Git hosting platforms:
225194

226-
#### Customizing Colors
227-
228-
To change colors, edit `~/.config/gitfetch/gitfetch.conf` and modify the ANSI escape codes:
229-
230-
**Example: Change header color to blue**
231-
232-
```ini
233-
header = \033[94m
234-
```
235-
236-
**Example: Change contribution graph colors to a purple theme**
237-
238-
```ini
239-
0 = \033[48;5;235m # Dark gray for no contributions
240-
1 = \033[48;5;60m # Dark purple
241-
2 = \033[48;5;62m # Medium purple
242-
3 = \033[48;5;64m # Light purple
243-
4 = \033[48;5;66m # Bright purple
244-
```
245-
246-
**Common ANSI Color Codes**:
247-
248-
- `\033[91m` = Bright Red
249-
- `\033[92m` = Bright Green
250-
- `\033[93m` = Bright Yellow
251-
- `\033[94m` = Bright Blue
252-
- `\033[95m` = Bright Magenta
253-
- `\033[96m` = Bright Cyan
254-
- `\033[97m` = Bright White
255-
256-
**Background Colors** (for contribution blocks):
257-
258-
- `\033[48;5;{color_code}m` where color_code is 0-255 (256-color palette)
195+
- **GitHub** - Uses GitHub CLI (gh) for authentication
196+
- **GitLab** - Uses GitLab CLI (glab) for authentication
197+
- **Gitea/Forgejo/Codeberg** - Direct API access with personal access tokens
198+
- **Sourcehut** - Direct API access with personal access tokens
259199

260-
Changes take effect immediately - no restart required.
200+
See `docs/providers.md` for detailed setup instructions for each provider.
261201

262202
## Caching
263203

docs/colors.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Color Configuration
2+
3+
gitfetch uses ANSI color codes for terminal output. Colors can be customized in the `[COLORS]` section of the config file.
4+
5+
## Available Colors
6+
7+
The following color keys can be customized:
8+
9+
### Text Formatting
10+
11+
- `reset`: Reset all formatting
12+
- `bold`: Bold text
13+
- `dim`: Dimmed text
14+
15+
### Basic Colors
16+
17+
- `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`
18+
19+
### Special Colors
20+
21+
- `orange`: Orange color
22+
- `accent`: Accent color for highlights
23+
- `header`: Header text color
24+
- `muted`: Muted text color
25+
26+
### Contribution Graph Colors (0-4)
27+
28+
- `0`: Lowest contribution level
29+
- `1`: Low contribution level
30+
- `2`: Medium contribution level
31+
- `3`: High contribution level
32+
- `4`: Highest contribution level
33+
34+
## Configuration
35+
36+
Colors use ANSI escape codes. Examples:
37+
38+
```ini
39+
[COLORS]
40+
reset = \033[0m
41+
bold = \033[1m
42+
red = \033[91m
43+
green = \033[92m
44+
blue = \033[94m
45+
header = \033[38;2;118;215;161m
46+
0 = \033[48;5;238m
47+
1 = \033[48;5;28m
48+
```
49+
50+
## ANSI Color Codes
51+
52+
- `\033[0m`: Reset
53+
- `\033[1m`: Bold
54+
- `\033[2m`: Dim
55+
- `\033[91m`: Bright Red
56+
- `\033[92m`: Bright Green
57+
- `\033[93m`: Bright Yellow
58+
- `\033[94m`: Bright Blue
59+
- `\033[95m`: Bright Magenta
60+
- `\033[96m`: Bright Cyan
61+
- `\033[97m`: Bright White
62+
63+
For 256-color codes, use `\033[38;5;{color_code}m` for foreground or `\033[48;5;{color_code}m` for background.
64+
65+
For RGB colors, use `\033[38;2;{r};{g};{b}m` for foreground or `\033[48;2;{r};{g};{b}m` for background.

docs/providers.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Git Providers
2+
3+
gitfetch supports multiple Git hosting providers. Configure your preferred provider in the config file.
4+
5+
## Supported Providers
6+
7+
### GitHub
8+
9+
- **provider**: `github`
10+
- **provider_url**: `https://api.github.com`
11+
- **Requirements**: GitHub CLI (`gh`) must be installed and authenticated
12+
- **Authentication**: Run `gh auth login`
13+
14+
### GitLab
15+
16+
- **provider**: `gitlab`
17+
- **provider_url**: `https://gitlab.com`
18+
- **Requirements**: GitLab CLI (`glab`) must be installed and authenticated
19+
- **Authentication**: Run `glab auth login`
20+
21+
### Gitea/Forgejo/Codeberg
22+
23+
- **provider**: `gitea`
24+
- **provider_url**: Custom URL (e.g., `https://codeberg.org`, `https://gitea.com`)
25+
- **Requirements**: None (uses API directly)
26+
- **Authentication**: Set personal access token in environment or use CLI tools
27+
28+
### Sourcehut
29+
30+
- **provider**: `sourcehut`
31+
- **provider_url**: `https://git.sr.ht`
32+
- **Requirements**: None (uses API directly)
33+
- **Authentication**: Set personal access token in environment
34+
35+
## Configuration
36+
37+
Set the provider and URL in your `gitfetch.conf`:
38+
39+
```ini
40+
[DEFAULT]
41+
provider = github
42+
provider_url = https://api.github.com
43+
```
44+
45+
## Adding New Providers
46+
47+
To add support for a new Git provider, implement a new fetcher class in `fetcher.py` and update the provider selection logic in `cli.py`.

0 commit comments

Comments
 (0)