Template:FileContentsByBot/ColorAverage

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
ColorAverage
ColorDelta ERGB  PeaksGradient
Template documentationview · edit · history · purge ]

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

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

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