entropy

package
v0.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HSV colorFormat = iota
	RGB
)
View Source
const ReplacePrefix = "const DATA = "
View Source
const ToReplace = "const DATA = {}"

Variables

This section is empty.

Functions

func HSVToRGB

func HSVToRGB(h, s, v float64) (r, g, b uint8)

HSVToRGB converts an HSV triple to an RGB triple. taken from https://github.com/Crazy3lf/colorconv/blob/master/colorconv.go

func Render

func Render(files []string, parser graph.NodeParser[*language.FileInfo], cfg RenderConfig) error

Types

type DirTree

type DirTree orderedmap.OrderedMap[string, DirTreeEntry]

func NewDirTree

func NewDirTree() *DirTree

func (*DirTree) AddDirs

func (d *DirTree) AddDirs(dirs []string)

func (*DirTree) AddDirsFromFileInfo added in v0.19.6

func (d *DirTree) AddDirsFromFileInfo(info *language.FileInfo)

func (*DirTree) ColorForDir added in v0.19.2

func (d *DirTree) ColorForDir(dirs []string, format colorFormat) []float64

ColorForDir smartly assigns a color for the specified dir based on all the dir tree that the codebase has. Files in the same folder will receive the same color, and colors for each sub folder will be assigned evenly following a radial distribution in an HSV wheel. As it goes deeper into more sub folders, colors fade, but the distribution rules are the same.

func (*DirTree) ColorForFileInfo added in v0.19.6

func (d *DirTree) ColorForFileInfo(info *language.FileInfo, format colorFormat) []float64

func (*DirTree) GroupingsForDir added in v0.19.2

func (d *DirTree) GroupingsForDir(dirs []string) []string

func (*DirTree) GroupingsForFileInfo added in v0.19.6

func (d *DirTree) GroupingsForFileInfo(info *language.FileInfo) []string

type DirTreeEntry

type DirTreeEntry struct {
	// contains filtered or unexported fields
}

type Graph

type Graph struct {
	Nodes     []Node `json:"nodes"`
	Links     []Link `json:"links"`
	EnableGui bool   `json:"enableGui"`
}
type Link struct {
	From      int64 `json:"from"`
	To        int64 `json:"to"`
	IsDir     bool  `json:"isDir"`
	IsPackage bool  `json:"isPackage"`
	IsCyclic  bool  `json:"isCyclic"`
}

type Node

type Node struct {
	Id           int64  `json:"id"`
	IsEntrypoint bool   `json:"isEntrypoint"`
	FileName     string `json:"fileName"`
	Group        string `json:"group,omitempty"`
	DirName      string `json:"dirName"`
	Loc          int    `json:"loc"`
	Size         int    `json:"size"`
	Color        []int  `json:"color,omitempty"`
	IsDir        bool   `json:"isDir"`
	IsPackage    bool   `json:"isPackage"`
}

type RenderConfig

type RenderConfig struct {
	NoOpen        bool
	EnableGui     bool
	RenderPath    string
	LoadCallbacks graph.LoadCallbacks[*language.FileInfo]
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL