Skip to content

Instantly share code, notes, and snippets.

View Lancewer's full-sized avatar
🎯
Focusing

Lancewer Lancewer

🎯
Focusing
View GitHub Profile
@keelii
keelii / vimrc
Last active April 6, 2024 15:51
vimrc for window
" ------------------------------
" Name: vimrc for windows
" Author: keelii
" Email: keeliizhou@gmail.com
" ------------------------------
" Startup {{{
filetype indent plugin on
augroup vimrcEx
@FredrikSjoberg
FredrikSjoberg / RGBtoHSV.swift
Last active April 11, 2024 11:22
Color space conversion between RGB and HSV
// https://www.cs.rit.edu/~ncs/color/t_convert.html
struct RGB {
// Percent
let r: Float // [0,1]
let g: Float // [0,1]
let b: Float // [0,1]
static func hsv(r: Float, g: Float, b: Float) -> HSV {
let min = r < g ? (r < b ? r : b) : (g < b ? g : b)
let max = r > g ? (r > b ? r : b) : (g > b ? g : b)