UNPKG

@tomplum/react-git-log

Version:

A flexible, themable, React component for visualising Git commit history, branch and tag metadata.

49 lines (48 loc) 2.03 kB
import { Commit } from '../../types/Commit'; export interface ThemeFunctions { theme: ThemeMode; hoverColour: string; textColour: string; getTooltipBackground: (commit: Commit) => string; hoverTransitionDuration: number; /** * Blends an RGB color with a background color to simulate an alpha effect. * * This function adjusts the given RGB color as if it were semi-transparent over a background, * without actually using an alpha channel. The result is a new solid RGB color that appears * visually similar to an `rgba()` color with transparency. * * @param rgb - The colour to shift in `rgb(r, g, b)` format. * @param opacity - The simulated alpha channel (range: `0` to `1`). * @returns The blended color in `rgb(r, g, b)` format. * * @example * ```ts * blendColorWithBackground('rgb(100, 200, 255)', 0.5) // "rgb(50, 100, 128)" (darker blue) * blendColorWithBackground('rgb(100, 200, 255)', 0.5) // "rgb(178, 228, 255)" (lighter blue) * ``` */ shiftAlphaChannel: (rgb: string, opacity: number) => string; /** * Reduces the opacity of the given RGB colour string. * * @param rbg The colour to reduce the opacity of. Must be in rgb(x, y, z) format. * @param opacity The desired opacity value from 0 to 1. */ reduceOpacity: (rbg: string, opacity: number) => string; getCommitColour: (commit: Commit) => string; getGraphColumnColour: (columnIndex: number) => string; } export type ThemeMode = 'light' | 'dark'; /** * The default theme renders merge nodes * with a different theme to make them * more distinct from regular commits. * * The plain theme renders all nodes * (except the index pseudo-node) the same. */ export type NodeTheme = 'default' | 'plain'; export type ThemeColours = 'rainbow-dark' | 'rainbow-light' | 'neon-aurora-dark' | 'neon-aurora-light'; export declare const neonAuroraDarkColours: string[]; export declare const neonAuroraLightColours: string[];