Template:FileContentsByBot/ColorAverage

From Wikimedia Commons, the free media repository
Jump to: navigation, search
ColorAverage
Color Delta E RGB     Peaks Gradient
Documentation icon Documentationviewedithistorypurge

This documentation is transcluded from Template:FileContentsByBot/ColorAverage/doc.

The average color of the image. Use one {{FileContentsByBot/ColorAverage}} for the formatting. Refer to {{FileContentsByBot/ColorAverage}} to find how you can read the data from the HTML.
Row's id: FileContentsByBot-ColorAverage. Caption class: bot-ColorAverage-legend.
Contains the required markup to represent the average color detected by a bot.

Usage

{{FileContentsByBot/ColorAverage
 |1 =
 |Color =
 |Delta_E =
 |RGB-00 =
 |RGB-01 =
 |RGB-02 =
 |RGBref-00 =
 |RGBref-01 =
 |RGBref-02 =
}}

Template parameters

Parameter Description Default Status
1 One {{FileContentsByBot/ColorAverage}} block. Confer example below. empty optional
Color Name associated to color.
Field's class: bot-ColorAverage-Color.
empty required
Delta_E The distance compared to the suggested color. Number only. Type: Float/Single.
Field's class: bot-ColorAverage-Delta_E.
empty required
RGB-00 The value of the red channel. Number only. Type: Single char/Byte.
Row's class: bot-ColorAverage-RGB. Field's class: bot-ColorAverage-RGB-R.
empty required
RGB-01 The value of the green channel. Number only. Type: Single char/Byte.
Row's class: bot-ColorAverage-RGB. Field's class: bot-ColorAverage-RGB-G.
empty required
RGB-02 The value of the blue channel. Number only. Type: Single char/Byte.
Row's class: bot-ColorAverage-RGB. Field's class: bot-ColorAverage-RGB-B.
empty required
RGBref-00 The value of the red channel associated with 'Color'. empty required
RGBref-01 The value of the green channel associated with 'Color'. empty required
RGBref-02 The value of the blue channel associated with 'Color'. empty required

Additional information

The template is intended to be used in the following namespaces: the File namespace

The template is intended to be used by the following user groups: Bots

Placement:

inside {{FileContentsByBot}} parameter Fields

See also

Localization

This template is not intended to be localized.

// Example reading the each single channel from the template
var $avgColorNode = $('#avgColorDetectedByBot');
var getChannelInfo = function(ch) {
   return $avgColorNode.find('.bot-ColorAverage-RGB-' + ch).text();
};
var r = getChannelInfo('R'), g = getChannelInfo('G'), b = getChannelInfo('B');
alert("The file's average color is R" + r + " G" + g + " B" + b);

Example of usage

{{FileContentsByBot/ColorAverage|
  {{FileContentsByBot/ColorAverage
  | Color = Purple
  | Delta_E = 25.830
  | RGB-00 = 119
  | RGB-01 = 124
  | RGB-02 = 173
  | RGBref-00 = 160
  | RGBref-01 = 32
  | RGBref-02 = 240
  }}
}}

How the bot obtained this information