Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cobra.Command{ Use: "regen [flags]", Short: "Regenerate colors from previous generation", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { ctx := cmd.Context() state, err := cache.LoadState() if err != nil { return fmt.Errorf("failed load current state: %v", err) } slog.Info("Generating color from cached state", "path", state.Path) cfg := material.GetConfig() colorMap, wu, err := material.GenerateFromQuantized( state.Quantized, cfg, ) if err != nil { return fmt.Errorf("failed to generate colors: %w", err) } customs, err := material.GenerateCustomColors(colorMap["primary"]) if err != nil { return err } based, err := base16.Generate(colorMap, wu) if err != nil { return err } path := state.Path mtype, err := mimetype.DetectFile(state.Path) if err == nil && strings.HasPrefix(mtype.String(), "video") { if preview, err := cache.GetPreview(path, state.Hash); err == nil { path = preview } } output := models.NewOutput(path, based, colorMap, customs) if config.JSON.Value() { err := json.NewEncoder(cmd.OutOrStdout()).Encode(output) if err != nil { slog.Error("Failed to encode output", "error", err) } } if config.SimpleJSON.Value() { err := models.WriteSimpleJSON(cmd.OutOrStdout(), output) if err != nil { slog.Error("Failed to encode output", "error", err) } } if config.DryRun.Value() { return nil } return templates.Execute(ctx, output) }, }
Command is the image command.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.