0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【React】Identiconをデフォルトアバターに使用する

Last updated at Posted at 2023-09-22

以下のライブラリを使用してIdentionを生成できます。

インストール

以下のコマンドでインストールします。

npm install boring-avatars

使用方法

以下のように記述することで使用できます。

import Avatar from "boring-avatars";

<Avatar
  size={128}
  name="User Name"
  variant="marble"
  colors={["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]}
/>;

nameの値によってIdentionが生成されます。

上記の場合には以下のようなアバターになります。

Avatar for User Name

また、variantにはmarble, beam, pixel,sunset, ring, bauhausが使用できそれぞれ以下のようなアバターになります。

  • marble
    Avatar for User Name(marble)

  • beam
    Avatar for User Name(beam)

  • pixel
    Avatar for User Name(pixel)

  • sunset
    Avatar for User Name(sunset)

  • ring
    Avatar for User Name(ring)

  • bauhaus
    Avatar for User Name(bauhaus)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?