一个基于实时天气数据驱动的ASCII动画终端天气应用。
A terminal weather app with ASCII animations driven by real-time weather data

原始链接: https://github.com/Veirt/weathr

## weathr:一个终端天气应用 **weathr** 是一个基于 Rust 的终端应用程序,以引人入胜的 ASCII 动画显示实时天气数据。它从 Open-Meteo 获取数据,展示雨、雪、雷暴和昼夜循环等天气状况,甚至包括动画飞机! **安装:** 需要 Rust;克隆 GitHub 仓库 ([https://github.com/veirt/weathr](https://github.com/veirt/weathr)) 并使用 `cargo install --path .` 安装。它也可通过 AUR 和 Nix Flake 获取。 **配置:** 可通过 `config.toml` 文件自定义(位置因操作系统而异),允许您设置位置(可用自动检测)、单位(摄氏度/华氏度、公里/英里等)以及 UI 偏好设置,例如隐藏 HUD。 **使用:** 运行 `weathr` 以获取实时天气。使用 `--simulate rain`、`--simulate snow` 等模拟条件。命令行标志会覆盖配置文件设置(例如 `weathr --imperial`)。按 'q' 或 Ctrl+C 退出。 **隐私:** 自动定位使用 ipinfo.io;为保护隐私,请禁用它并手动设置坐标。该应用程序采用 GPL-3.0-or-later 许可。

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 一个带有 ASCII 动画的终端天气应用,由实时天气数据驱动 (github.com/veirt) 10 分,by forinti 46 分钟前 | 隐藏 | 过去 | 收藏 | 1 条评论 帮助 dbacar 12 分钟前 | 下一个 [–] 很棒的项目。但运行 "cargo install weathr" ,是我吗,还是 Rust 正在成为下一个 Node.js?:D 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Crates.io Downloads License

A terminal weather app with ASCII animations driven by real-time weather data.

Features real-time weather from Open-Meteo with animated rain, snow, thunderstorms, flying airplanes, day/night cycles, and auto-location detection.

You need Rust installed.

git clone https://github.com/veirt/weathr.git
cd weathr
cargo install --path .

Available in AUR:

or

Available as a flake:

inputs = {
    weathr.url = "github:Veirt/weathr";
};

Add to packages:

environment.systemPackages = [
    inputs.weathr.packages.${system}.default
];

or use home-manager module option:

imports = [
    inputs.weathr.homeModules.weathr
];

programs.weathr = {
    enable = true;
    settings = {
        hide_hud = true;
    };
};

The config file location depends on your platform:

  • Linux: ~/.config/weathr/config.toml (or $XDG_CONFIG_HOME/weathr/config.toml)
  • macOS: ~/Library/Application Support/weathr/config.toml

You can also place a config.toml in the current working directory, which takes priority over the default location.

# Linux
mkdir -p ~/.config/weathr

# macOS
mkdir -p ~/Library/Application\ Support/weathr

Edit the config file at the appropriate path for your platform:

# Hide the HUD (Heads Up Display) with weather details
hide_hud = false

# Run silently without startup messages (errors still shown)
silent = false

[location]
# Location coordinates (overridden if auto = true)
latitude = 40.7128
longitude = -74.0060

# Auto-detect location via IP (defaults to true if config missing)
auto = false

# Hide the location name in the UI
hide = false

[units]
# Temperature unit: "celsius" or "fahrenheit"
temperature = "celsius"

# Wind speed unit: "kmh", "ms", "mph", or "kn"
wind_speed = "kmh"

# Precipitation unit: "mm" or "inch"
precipitation = "mm"
# Tokyo, Japan
latitude = 35.6762
longitude = 139.6503

# Sydney, Australia
latitude = -33.8688
longitude = 151.2093

Run with real-time weather:

Simulate weather conditions for testing:

# Simulate rain
weathr --simulate rain

# Simulate snow at night
weathr --simulate snow --night

# Clear day with falling leaves
weathr --simulate clear --leaves

Available weather conditions:

  • Clear Skies: clear, partly-cloudy, cloudy, overcast
  • Precipitation: fog, drizzle, rain, freezing-rain, rain-showers
  • Snow: snow, snow-grains, snow-showers
  • Storms: thunderstorm, thunderstorm-hail

Override configuration:

# Use imperial units (°F, mph, inch)
weathr --imperial

# Use metric units (°C, km/h, mm) - default
weathr --metric

# Auto-detect location via IP
weathr --auto-location

# Hide location coordinates
weathr --hide-location

# Hide status HUD
weathr --hide-hud

# Run silently (suppress non-error output)
weathr --silent

# Combine flags
weathr --imperial --auto-location
  • q or Q - Quit
  • Ctrl+C - Exit

The application respects several environment variables:

  • NO_COLOR - When set, disables all color output (accessibility feature)
  • COLORTERM - Detects truecolor support (values: "truecolor", "24bit")
  • TERM - Used for terminal capability detection (e.g., "xterm-256color")

Examples:

# Disable colors for accessibility
NO_COLOR=1 weathr

When using auto = true in config or the --auto-location flag, the application makes a request to ipinfo.io to detect your approximate location based on your IP address.

This is optional. You can disable auto-location and manually specify coordinates in your config file to avoid external API calls.

GPL-3.0-or-later

Weather data provided by Open-Meteo.com under the CC BY 4.0 license.

  • Source: https://www.asciiart.eu/
  • House: Joan G. Stark
  • Airplane: Joan G. Stark
  • Sun: Hayley Jane Wakenshaw (Flump)
  • Moon: Joan G. Stark

Note: If any ASCII art is uncredited or misattributed, it belongs to the original owner.

联系我们 contact @ memedata.com