ItsOnlyBinary / kiwiirc-plugin-avatars

Apache License 2.0
1 stars 0 forks source link

Avatars for Kiwi IRC

This plugin add avatars to all users, they are locally generated to reduce network calls.

It is powered by DiceBear


Dependencies

Building and installing

  1. Build the plugin

    $ yarn
    $ yarn build

    The plugin will then be created at dist/plugin-avatars.js

    You will also find many other avatar styles starting with dist/plugin-avatars-

  2. Copy the plugin to your Kiwi webserver

    The plugin file must be loadable from a webserver. Creating a plugins/ folder with your KiwiIRC files is a good place to put it.

  3. Add the plugin to Kiwi IRC

    In your kiwi config.json file, find the plugins section and add:

    {"name": "avatars", "url": "/plugins/plugin-avatars.js"}

    [Optional] While it is possible to manually specify additional styles as plugins, an autoload feature is available to simplify this process. If you prefer to specify styles and disable autoLoad, include the following configuration in your config.json file:

    {"name": "avatars-micah", "url": "/plugins/plugin-avatars/micah.js"}

Configuration

To set the default style add the following json to your config.json

"plugin-avatars" : {
   // URL path to other avatar styles
   // if not set this to use auto detection
   "path": "/static/plugins/plugin-avatars/%style%.js",

   // Default avatar style that will be used
   "style": "initials",

   // Allows specifying options modifiers for the different styles
   "stylesOptions": {
      "micah": { "translateY": 5 }
   }

   // Allow styles to be auto loaded if they exist
   "autoLoad": true
},

It is possible to specify which styles can be autoloaded, or tweak the style options by setting "styles" array with the contents from config-styles.json and editing the contents.

For the different options that can be specified in stylesOptions see here: DiceBear/styles

Advanced

There are some small size benefits to including your wanted styles into the main plugin.

To do so take a look in ./src/plugin.js.

Import the styles you want the same way initials is imported, then add them to the includedStyles object, making sure the key is all lowercase.

You can also add extra options for each avatar style, see DiceBear/styles for the options.

License

Licensed under the Apache License, Version 2.0.