Strava
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
功能
Strava 是一款流行的运动追踪应用,支持骑行、跑步及其他训练活动。 为保持训练目标,及时获得提醒至关重要。 Oh My Posh 的 Strava 组件会显示您最近的运动记录, 并通过颜色变化提示是否该离开电脑去运动了。
访问 Strava 数据
授权 Oh My Posh 访问 Strava 数据需开启公开活动读取权限。 系统将生成访问令牌和刷新令牌,请将这些令牌粘贴至 Strava 组件配置中。
点击下方链接关联 Strava 账户:
示例配置
此配置规则为:近两日内有运动时显示绿色背景,
近五日内有运动时显示橙色背景,否则显示红色背景。下方 foreground_templates 示例可设为单色,
只要该颜色在您的背景色下清晰可见即可。
- json
- yaml
- toml
{
"type": "strava",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#000000",
"background_templates": [
"{{ if gt .Hours 100 }}#dc3545{{ end }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}",
"{{ if lt .Hours 50 }}#28a745{{ end }}"
],
"foreground_templates": [
"{{ if gt .Hours 100 }}#FFFFFF{{ end }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}",
"{{ if lt .Hours 50 }}#FFFFFF{{ end }}"
],
"template": " {{.Name}} {{.Ago}} {{.Icon}} ",
"options": {
"access_token": "11111111111111111",
"refresh_token": "1111111111111111",
"http_timeout": 1500
}
}
type: strava
style: powerline
powerline_symbol:
foreground: "#ffffff"
background: "#000000"
background_templates:
- "{{ if gt .Hours 100 }}#dc3545{{ end }}"
- "{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}"
- "{{ if lt .Hours 50 }}#28a745{{ end }}"
foreground_templates:
- "{{ if gt .Hours 100 }}#FFFFFF{{ end }}"
- "{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}"
- "{{ if lt .Hours 50 }}#FFFFFF{{ end }}"
template: " {{.Name}} {{.Ago}} {{.Icon}} "
options:
access_token: "11111111111111111"
refresh_token: "1111111111111111"
http_timeout: 1500
type = "strava"
style = "powerline"
powerline_symbol = ""
foreground = "#ffffff"
background = "#000000"
background_templates = [ "{{ if gt .Hours 100 }}#dc3545{{ end }}", "{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}", "{{ if lt .Hours 50 }}#28a745{{ end }}" ]
foreground_templates = [ "{{ if gt .Hours 100 }}#FFFFFF{{ end }}", "{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}", "{{ if lt .Hours 50 }}#FFFFFF{{ end }}" ]
template = " {{.Name}} {{.Ago}} {{.Icon}} "
[options]
access_token = "11111111111111111"
refresh_token = "1111111111111111"
http_timeout = 1500
选项
| Name | Type | Default | Description |
|---|---|---|---|
access_token | template | token from Strava login, see login link in section above. | |
refresh_token | template | token from Strava login, see login link in section above. | |
expires_in | int | 0 | the default timeout of the token from the Strava login |
http_timeout | int | 20 | in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data? |
ride_icon | string | \uf206 | |
run_icon | string | \ue213 | |
skiing_icon | string | \ue213 | |
workout_icon | string | \ue213 | |
unknown_activity_icon | string | \ue213 |
模板 (信息)
默认模板
{{ if .Error }}{{ .Error }}{{ else }}{{ .Ago }}{{ end }}
属性
| Name | Type | Description |
|---|---|---|
.ID | time | The id of the entry |
.DateString | time | The timestamp of the entry |
.Type | string | Activity types as used in strava |
.UtcOffset | int | The UTC offset |
.Hours | int | Number of hours since last activity |
.Name | string | The name of the activity |
.Duration | float64 | Total duration in seconds |
.Distance | float64 | Total distance in meters |
.DeviceWatts | bool | Device has watts |
.AverageWatts | float64 | Average watts |
.WeightedAverageWatts | float64 | Weighted average watts |
.AverageHeartRate | float64 | Average heart rate |
.MaxHeartRate | float64 | Max heart rate |
.KudosCount | int | Kudos count |
.Icon | string | Activity based icon |
现在,出门享受骑行的乐趣或来场畅快奔跑吧!