Use Identicons for avatars in Grav's Admin-plugin.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
admin/themes/grav/templates/partials
vendor
.gitignore
CHANGELOG.md
LICENSE
README.md
adminidenticons.php
adminidenticons.yaml
blueprints.yaml
composer.json
composer.lock

README.md

Grav Admin Identicons Plugin

Use identicons for avatars in the Admin-plugin, through customizable, yet classical identicons and classical patterns. The default configuration yields an avatar like this:

Default Identicon

Every user avatar is unique, as users full names are hashed into virtually random strings used for generating the identicons.

Installation and Configuration

  1. Download the zip version of this repository and unzip it under /your/site/grav/user/plugins.
  2. Rename the folder to adminidenticons.

You should now have all the plugin files under

/your/site/grav/user/plugins/adminidenticons

The plugin is enabled by default, and can be disabled by copying user/plugins/adminidenticons/adminidenticons.yaml into user/config/plugins/adminidenticons.yaml and setting enabled: false.

Settings

All settings can be set through adminidenticons.yaml, or using the Admin-plugin interface. Overview:

Variable Default Options Note
enabled true true or false
type identicon identicon or pattern
border_radius 100 0 to 100
background '#f8f8f8' Hex color code Encapsulated in quotes.
foreground '#64F0FF' Hex color code Encapsulated in quotes.
varied true true or false Sets varied-color mode for identicon-type.
padding 28 4 to 60 Padding around identicon-type.
spacing 0 0 to 30 Space between tiles inidenticon-type.
rows 0 0 to 20 Rows inidenticon-type.
columns 0 0 to 20 Columns inidenticon-type.
tiles 6 1 to 25 Number of patterns inpattern-type.
colors 2 1 to 25 Number of colors inpattern-type.

Note: Values higher than 12 for tiles or colors cause higher levels of memory- and processing power-usage by PHP.

Example configuration outputs

Identicons

From the Avity-repository.

Type Example
Red Background and Foreground
Blue Background and Foreground
Rows and Columns
Padding
Varied Blue
Varied Red
Spacing

Patterns

From the ranvis/identicon-wiki.

Random

    

    

Tiles parameter

1 2 3 4 5 6 7 8 9 10

Colors parameter

1 2 3 4 5 6 7 8 9 10

Notes

Generating avatars with this plugin takes processing power and uses memory, which - depending on your configuration - will be negligible compared to requesting an external image. Also, when the site is cached the extra load is not noticeable. All images are embedded as Base64 data-URIs, thus reducing internal HTTP requests and the dependency on the external request from Gravatar. All users will also automatically get their own avatar, which is not the case with Gravatar.

The plugin overrides the image source for Gravatar in the navigation-bar and on the userinfo-page, as well as CSS that overrides the border-radius for these images. The range-field, used by forms to provide a slider to select a value, is overridden to show what value is selected.

MIT License 2017 by Ole Vik.