<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.mimikkofans.club/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E5%9D%97%3AColorOps</id>
	<title>模块:ColorOps - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mimikkofans.club/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E5%9D%97%3AColorOps"/>
	<link rel="alternate" type="text/html" href="https://wiki.mimikkofans.club/index.php?title=%E6%A8%A1%E5%9D%97:ColorOps&amp;action=history"/>
	<updated>2026-04-08T03:08:56Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.mimikkofans.club/index.php?title=%E6%A8%A1%E5%9D%97:ColorOps&amp;diff=414&amp;oldid=prev</id>
		<title>一位史蒂夫：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://wiki.mimikkofans.club/index.php?title=%E6%A8%A1%E5%9D%97:ColorOps&amp;diff=414&amp;oldid=prev"/>
		<updated>2025-09-01T16:40:02Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2025年9月2日 (二) 00:40的版本&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key wiki_club:diff::1.12:old-413:rev-414 --&gt;
&lt;/table&gt;</summary>
		<author><name>一位史蒂夫</name></author>
	</entry>
	<entry>
		<id>https://wiki.mimikkofans.club/index.php?title=%E6%A8%A1%E5%9D%97:ColorOps&amp;diff=413&amp;oldid=prev</id>
		<title>abaaba&gt;Lih：​搬运自萌娘百科的同名条目</title>
		<link rel="alternate" type="text/html" href="https://wiki.mimikkofans.club/index.php?title=%E6%A8%A1%E5%9D%97:ColorOps&amp;diff=413&amp;oldid=prev"/>
		<updated>2022-09-23T09:06:13Z</updated>

		<summary type="html">&lt;p&gt;搬运自萌娘百科的同名条目&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local module = {}&lt;br /&gt;
&lt;br /&gt;
local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
local Color = require(&amp;#039;Module:color&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
function _main(args)&lt;br /&gt;
  local action = args[1]&lt;br /&gt;
  local arg1 = args[2]&lt;br /&gt;
  local arg2 = args[3]&lt;br /&gt;
  local arg3 = args[4]&lt;br /&gt;
  &lt;br /&gt;
  if action == &amp;#039;reverse&amp;#039; then&lt;br /&gt;
    local color = arg1&lt;br /&gt;
&lt;br /&gt;
    return Color.create(color):reverse():toString(&amp;#039;hex&amp;#039;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if action == &amp;#039;random&amp;#039; then&lt;br /&gt;
    local min = arg1 or 0&lt;br /&gt;
    local max = arg2 or 255&lt;br /&gt;
&lt;br /&gt;
    return Color.random(min, max):toString(&amp;#039;hex&amp;#039;)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  if action == &amp;#039;opacity&amp;#039; then&lt;br /&gt;
    local color = arg1&lt;br /&gt;
    local opacity = arg2&lt;br /&gt;
&lt;br /&gt;
  	return Color.create(color):setOpacity(opacity):toString()&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if action == &amp;#039;isLight&amp;#039; then&lt;br /&gt;
    local color = arg1&lt;br /&gt;
    return Color.create(color):isLight() and 1 or &amp;#039;&amp;#039;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if action == &amp;#039;isDark&amp;#039; then&lt;br /&gt;
    local color = arg1&lt;br /&gt;
    return Color.create(color):isDark() and 1 or &amp;#039;&amp;#039;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if action == &amp;#039;mix&amp;#039; then&lt;br /&gt;
    local color1 = Color.create(arg1)&lt;br /&gt;
    local color2 = Color.create(arg2)&lt;br /&gt;
    local weight = arg3&lt;br /&gt;
&lt;br /&gt;
    return color1:mix(color2, weight):rgb():toString(&amp;#039;hex-opacity&amp;#039;)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    -- 映射要使用的每组操作颜色属性的方法&lt;br /&gt;
    local methods = {&lt;br /&gt;
      saturation = {&amp;#039;saturate&amp;#039;, &amp;#039;desaturate&amp;#039;},&lt;br /&gt;
      lightness = {&amp;#039;lighten&amp;#039;, &amp;#039;darken&amp;#039;},&lt;br /&gt;
      default = {&amp;#039;darken&amp;#039;, &amp;#039;lighten&amp;#039;}	-- 历史遗留原因，默认是加深、减淡&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  if action:find(&amp;#039;^test:[ls]?&amp;#039;) then&lt;br /&gt;
    function block(text, color)&lt;br /&gt;
      return &amp;#039;&amp;lt;ruby style=&amp;quot;color:&amp;#039;..color..&amp;#039;&amp;quot;&amp;gt;■&amp;lt;rt style=&amp;quot;color:black&amp;quot;&amp;gt;&amp;#039;..text..&amp;#039;&amp;lt;rt&amp;gt;&amp;lt;/ruby&amp;gt;&amp;amp;nbsp;&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local property = ({&lt;br /&gt;
        s = &amp;#039;saturation&amp;#039;,&lt;br /&gt;
        l = &amp;#039;lightness&amp;#039;&lt;br /&gt;
    })[action:sub(#action, #action)] or &amp;#039;default&amp;#039;&lt;br /&gt;
    local usedMethods = methods[property]&lt;br /&gt;
    &lt;br /&gt;
    local color = Color.create(arg1)&lt;br /&gt;
	  local left = &amp;#039;&amp;#039;&lt;br /&gt;
	  local right = &amp;#039;&amp;#039;&lt;br /&gt;
	  for i=1, 9 do&lt;br /&gt;
	    i = i * 10&lt;br /&gt;
	    local clonedColor1 = color:clone()&lt;br /&gt;
	    local clonedColor2 = color:clone()&lt;br /&gt;
	    &lt;br /&gt;
	    left = block(&amp;#039;-&amp;#039;..i, Color[usedMethods[2]](clonedColor1, i):toString())..left&lt;br /&gt;
	    right = right..block(&amp;#039;+&amp;#039;..i, Color[usedMethods[1]](clonedColor2, i):toString())&lt;br /&gt;
	  end&lt;br /&gt;
	  return &amp;#039;&amp;lt;div style=&amp;quot;font-size:30px&amp;quot;&amp;gt;&amp;#039;..left..block(&amp;#039;▼&amp;#039;, color:toString())..right..&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
  if action:find(&amp;#039;^[sl]?[%+%-]&amp;#039;) then&lt;br /&gt;
    local color = Color.create(arg1)&lt;br /&gt;
    local operateProperty = &amp;#039;default&amp;#039;&lt;br /&gt;
    local operator = &amp;#039;&amp;#039;&lt;br /&gt;
    local ratio = 0&lt;br /&gt;
&lt;br /&gt;
    if action:find(&amp;#039;^[sl]&amp;#039;) then &lt;br /&gt;
      operateProperty = ({&lt;br /&gt;
        s = &amp;#039;saturation&amp;#039;,&lt;br /&gt;
        l = &amp;#039;lightness&amp;#039;&lt;br /&gt;
      })[action:sub(1, 1)]&lt;br /&gt;
&lt;br /&gt;
      operator = action:sub(2, 2)&lt;br /&gt;
      ratio = tonumber(action:sub(3)) or 10&lt;br /&gt;
    else&lt;br /&gt;
      operator = action:sub(1, 1)&lt;br /&gt;
      ratio = tonumber(action:sub(2)) or 10&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local usedMethods = methods[operateProperty]&lt;br /&gt;
    local usedMethod = operator == &amp;#039;+&amp;#039; and usedMethods[1] or usedMethods[2]&lt;br /&gt;
    &lt;br /&gt;
    return Color[usedMethod](color, ratio):toString(&amp;#039;hex&amp;#039;)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function module.main(frame)&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	return _main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return module&lt;/div&gt;</summary>
		<author><name>abaaba&gt;Lih</name></author>
	</entry>
</feed>