Formulas and examples
Convert timestamp to avatar background color
Formula: (T
- timestamp)
Example: (JavaScript)
const timestampToHSV = (timestamp) => {
const h = timestamp % 360; // Hue: 0-360
const s = 0.2 + ((timestamp % 1000) / 1000) * 0.4; // Saturation: 20%-60%
const v = 1; // Value: 100%
return { h, s, v };
};
const timestamp = 1700000000; // Timestamp in seconds
const hsv = timestampToHSV(timestamp);
console.log(`HSV(${hsv.h.toFixed(2)}, ${(hsv.s * 100).toFixed(2)}%, ${(hsv.v * 100).toFixed(2)}%)`);