---
title: "ターミナルがダサいとモテない。WezTermの背景をUnsplashで変える編。 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-wezterm-unsplash-background"
description: "WezTermをUnsplashでおしゃれにする！ Photo by Billy Huynh on Unsplash こんにちは、長谷川です。 WezTermの背景をコマンドで変えられるようにしよ〜🔊 .config/wezterm/wezterm.lua 以下を加えてください。 細かい色や数値はお好きにどうぞ🧛 config.background config.window background gradient 若干斜めにグラデ…"
---

# ターミナルがダサいとモテない。WezTermの背景をUnsplashで変える編。

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2026年2月13日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)[#WezTerm](/tags/wezterm/)[#Unsplash API](/tags/unsplash-api/)

![ターミナルがダサいとモテない。WezTermの背景をUnsplashで変える編。](/_astro/ogp.BPRA_X3N_Z1pQxkj.webp)

Photo by [Billy Huynh](https://unsplash.com/@billy_huy?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

WezTermをUnsplashでおしゃれにする！

こんにちは、長谷川です。

WezTermの背景をコマンドで変えられるようにしよ〜🔊

## .config/wezterm/wezterm.lua

以下を加えてください。

細かい色や数値はお好きにどうぞ🧛

### config.background

Plain textcontent\_copy

```
-------------------------------------------------------------------------------
-- background
config.background = {
 {
  source = { File = wezterm.config_dir .. "/unsplash.jpg" },
  height = "Cover",
  --width = "Cover",
  hsb = {
   brightness = 0.2,
   hue = 1,
   saturation = 1,
  },
  opacity = 0.2,
 },
}
```

### config.window\_background\_gradient

若干斜めにグラデーションします🤣

Plain textcontent\_copy

```
-- background_gradient
config.window_background_gradient = {
 -- Can be "Vertical" or "Horizontal".  Specifies the direction
 -- in which the color gradient varies.  The default is "Horizontal",
 -- with the gradient going from left-to-right.
 -- Linear and Radial gradients are also supported; see the other
 -- examples below
 -- orientation = "Vertical",
 orientation = { Linear = { angle = -50.0 } },

 -- Specifies the set of colors that are interpolated in the gradient.
 -- Accepts CSS style color specs, from named colors, through rgb
 -- strings and more
 -- colors = {
 -- "#0f0c29",
 -- "#302b63",
 -- "#24243e",
 --},
 colors = {
  "#0f0c29",
  "#282a36",
  "#343746",
  "#3a3f52",
  "#343746",
  "#282a36",
 },
 -- colors = { "Inferno" },

 -- Instead of specifying `colors`, you can use one of a number of
 -- predefined, preset gradients.
 -- A list of presets is shown in a section below.
 -- preset = "Warm",

 -- Specifies the interpolation style to be used.
 -- "Linear", "Basis" and "CatmullRom" as supported.
 -- The default is "Linear".
 interpolation = "Linear",

 -- How the colors are blended in the gradient.
 -- "Rgb", "LinearRgb", "Hsv" and "Oklab" are supported.
 -- The default is "Rgb".
 blend = "Rgb",

 -- To avoid vertical color banding for horizontal gradients, the
 -- gradient position is randomly shifted by up to the `noise` value
 -- for each pixel.
 -- Smaller values, or 0, will make bands more prominent.
 -- The default value is 64 which gives decent looking results
 -- on a retina macbook pro display.
 noise = 0,

 -- By default, the gradient smoothly transitions between the colors.
 -- You can adjust the sharpness by specifying the segment_size and
 -- segment_smoothness parameters.
 -- segment_size configures how many segments are present.
 -- segment_smoothness is how hard the edge is; 0.0 is a hard edge,
 -- 1.0 is a soft edge.
 segment_size = 10,
 segment_smoothness = 1.0,
}
```

### config.window\_background\_opacity

背景はやっぱり透過

Plain textcontent\_copy

```
-------------------------------------------------------------------------------
-- window
-- window_background_opacity
config.window_background_opacity = 0.80
```

### config.window\_background\_blur

背景は絶対ぼかし

Plain textcontent\_copy

```
-- blur
config.macos_window_background_blur = 20
```

## .bashrc

.bashrcに以下を追加しましょう

[unsplash](https://unsplash.com/)の[API Key](https://unsplash.com/oauth/applications)を取得する必要があります。

Requirementsは以下

-   jq
-   curl

[unsplash](https://unsplash.com/)の[API Key](https://unsplash.com/oauth/applications)をYOUR\_API\_KEY\_HEREに入れてください。

自分は、[pier](https://github.com/pier-cli/pier)に登録してるものがあってそれを使ってます。  
これは[Codex](https://openai.com/ja-JP/codex/)で修正して貰った・・・🤣

Plain textcontent\_copy

```
#!/usr/bin/env bash
set -euo pipefail

# =========================
# Config
# =========================
UNSPLASH_URL="https://api.unsplash.com/photos/random"
UNSPLASH_QUERY="${1:-galaxy}"
UNSPLASH_ACCESS_KEY="YOUR_API_KEY_HERE"

STATE_DIR="${HOME}/.local/state/wezterm"
CONFIG_DIR="${HOME}/.config/wezterm"
JSON_FILE="${STATE_DIR}/unsplash.json"
IMAGE_FILE="${CONFIG_DIR}/unsplash.jpg"

# =========================
# Dependency Checks
# =========================
require_cmd() {
  command -v "$1" >/dev/null 2>&1 || {
    echo "Error: $1 is required but not installed."
    exit 1
  }
}

require_cmd curl
require_cmd jq
require_cmd wezterm

if [[ -z "${UNSPLASH_ACCESS_KEY}" ]]; then
  echo "Error: UNSPLASH_ACCESS_KEY is not set."
  exit 1
fi

# =========================
# Prepare Directories
# =========================
mkdir -p "${STATE_DIR}"
mkdir -p "${CONFIG_DIR}"

# =========================
# Request Random Image
# =========================
echo "Requesting Unsplash API..."
echo "Query: ${UNSPLASH_QUERY}"

curl -s \
  -o "${JSON_FILE}" \
  "${UNSPLASH_URL}?client_id=${UNSPLASH_ACCESS_KEY}&query=${UNSPLASH_QUERY}"

IMAGE_URL="$(jq -r '.urls.full // empty' "${JSON_FILE}")"

if [[ -z "${IMAGE_URL}" ]]; then
  echo "Error: Failed to extract image URL from API response."
  cat "${JSON_FILE}"
  exit 1
fi

echo "Downloading image..."
curl -s -L -o "${IMAGE_FILE}" "${IMAGE_URL}"

# =========================
# Display in WezTerm
# =========================
wezterm imgcat --height=50% "${IMAGE_FILE}"

echo "Done."
```

上のscriptを実際に実行すると

Plain textcontent\_copy

```
./wezterm-unsplash.sh [categoryname]
```

![\=========================の画面（1）](/_astro/image-02.D_f8oXpN_1Wq0Dn.webp)

Plain textcontent\_copy

```
./wezterm-unsplash.sh travel
```

![\=========================の画面（2）](/_astro/image-03.-jfN8nvU_Z1vowtf.webp)

![\=========================の画面（3）](/_astro/image-04.DSgDJ6wM_Z5oFvE.webp)

こんな感じになります。  
（画像が古いのはMediumにずっとdraftのまま埋もれてました・・・😅）

気分で引数を変えて叩いてます。

背景がばんばん変わるので飽きません。

ターミナル環境について他の記事も書いているので、よろしければこちらもご覧ください！  
[『ターミナルがダサいとモテない』シリーズ一覧](https://blog.grasys.io/tags/series-terminal-update)

転載：[ターミナルがダサいとモテない。WezTermの背景をUnsplashで変える編。](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-wezterm%E3%81%AE%E8%83%8C%E6%99%AF%E3%82%92unsplash%E3%81%A7%E5%A4%89%E3%81%88%E3%82%8B%E7%B7%A8-4086d3ec602f)

この記事は [Medium（@yusuke\_h）](https://medium.com/@yusuke_h) からの転載です。

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)