Skip to content

Instantly share code, notes, and snippets.

View JaminQ's full-sized avatar
🎯
Focusing

JaminQian JaminQ

🎯
Focusing
  • Tencent WeChat
  • Guangzhou, China
View GitHub Profile
@JaminQ
JaminQ / reverseColor.js
Created December 17, 2019 13:00
参考Google Chrome内核实现的反色算法
function fixDarkMode() {
function rgb2lab(rgb) {
var r = rgb[0] / 255,
g = rgb[1] / 255,
b = rgb[2] / 255,
x, y, z;
r = (r > 0.04045) ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
g = (g > 0.04045) ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
b = (b > 0.04045) ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
@JaminQ
JaminQ / darkModeHandler.ts
Last active January 3, 2020 06:39 — forked from hteumeuleu/darkModeHandler.ts
Outlook.com darkModeHandler - Support alpha
import ContentHandler from '../schema/ContentHandler';
import { transformElementForDarkMode, AlteredElement } from 'owa-dark-mode-utilities';
import {
ATTR_COLOR,
ATTR_BGCOLOR,
DATA_OG_STYLE_COLOR,
DATA_OG_ATTR_COLOR,
DATA_OG_STYLE_BACKGROUNDCOLOR,
DATA_OG_ATTR_BGCOLOR,
} from 'owa-content-colors';
@JaminQ
JaminQ / bash.sh
Last active September 21, 2018 08:26
qinit_config
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
echo " ($branch)"
fi
}