문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 중 하나의 권한을 가진 사용자에게 제한됩니다: 사용자, 관리자. 문서를 고치려면 이메일 인증 절차가 필요합니다. 사용자 환경 설정에서 이메일 주소를 입력하고 이메일 주소 인증을 해주시기 바랍니다. 문서의 원본을 보거나 복사할 수 있습니다. local p = {} -- 헥스 코드에서 RGB 추출 local function hex_to_rgb(hex) hex = hex:match("^#?(%x%x%x%x%x%x)$") if not hex then return nil, "유효하지 않은 헥스 코드입니다. 6자리 색상 코드 (#RRGGBB)를 입력하세요." end local r = tonumber(hex:sub(1, 2), 16) local g = tonumber(hex:sub(3, 4), 16) local b = tonumber(hex:sub(5, 6), 16) return r, g, b end -- RGB에서 헥스 코드 생성 local function rgb_to_hex(r, g, b) return string.format("#%02X%02X%02X", math.floor(r), math.floor(g), math.floor(b)) end -- 밝기 조정 local function adjust_brightness(r, g, b, factor) local function adjust(value) local adjusted = value * factor return math.max(0, math.min(255, adjusted)) end return adjust(r), adjust(g), adjust(b) end -- 메인 함수 function p.adjust(frame) local hex = frame.args[1] or "#808080" -- 기본 색상 local direction = frame.args[2] or "brighten" -- 기본 방향 local percentage = tonumber(frame.args[3]:match("%d+")) or 0 -- 기본 퍼센트 if percentage < 0 or percentage > 100 then return "퍼센트는 0%에서 100% 사이여야 합니다." end -- 밝기 조정을 위한 factor 계산 local factor if direction == "brighten" then factor = 1 + (percentage / 100) elseif direction == "darken" then factor = 1 - (percentage / 100) else return "방향은 'brighten' 또는 'darken'만 가능합니다." end -- RGB 변환 및 조정 local r, g, b, err = hex_to_rgb(hex) if not r then return err end r, g, b = adjust_brightness(r, g, b, factor) return rgb_to_hex(r, g, b) end return p 이 문서에서 사용한 틀: 모듈:AdjustBrightness/설명문서 (원본 보기) 모듈:AdjustBrightness 문서로 돌아갑니다.