diff --git a/pkg/styles/style.go b/pkg/styles/style.go index ced5a03..798715b 100644 --- a/pkg/styles/style.go +++ b/pkg/styles/style.go @@ -47,17 +47,83 @@ var Title = lipgloss.NewStyle(). var Divider = lipgloss.NewStyle(). Foreground(lipgloss.Color("8")) - // Define a map for grade to color mapping -var ReportsSvgGradeColorMap = map[string]string{ - "A": "#54FF77", - "B": "#04E8B0", - "C": "#FFF586", - "D": "#FFA463", - "F": "#FF0057", +// Define a map for grade to color mapping +var ReportsSvgGradeColorMap = map[string]lipgloss.CompleteAdaptiveColor{ + "A": { + Light: lipgloss.CompleteColor{ + TrueColor: "#2ABC48", + ANSI256: "6", + ANSI: "6", + }, + Dark: lipgloss.CompleteColor{ + TrueColor: "#54FF77", + ANSI256: "8", + ANSI: "8", + }, + }, + "B": { + Light: lipgloss.CompleteColor{ + TrueColor: "#04E8B0", + ANSI256: "14", + ANSI: "14", + }, + Dark: lipgloss.CompleteColor{ + TrueColor: "#04E8B0", + ANSI256: "14", + ANSI: "14", + }, + }, + "C": { + Light: lipgloss.CompleteColor{ + TrueColor: "#B59D03", + ANSI256: "3", + ANSI: "3", + }, + Dark: lipgloss.CompleteColor{ + TrueColor: "#FFF36B", + ANSI256: "11", + ANSI: "1", + }, + }, + "D": { + Light: lipgloss.CompleteColor{ + TrueColor: "#FF862F", + ANSI256: "11", + ANSI: "1", + }, + Dark: lipgloss.CompleteColor{ + TrueColor: "#FF862F", + ANSI256: "11", + ANSI: "11", + }, + }, + "F": { + Light: lipgloss.CompleteColor{ + TrueColor: "#FF0057", + ANSI256: "9", + ANSI: "9", + }, + Dark: lipgloss.CompleteColor{ + TrueColor: "#FF0057", + ANSI256: "9", + ANSI: "9", + }, + }, } // Define a fallback color constant -const ReportsSvgColorBoundaryFallbackColor = "#6C7285" +var ReportsSvgColorBoundaryFallbackColor = lipgloss.CompleteAdaptiveColor{ + Light: lipgloss.CompleteColor{ + TrueColor: "#3C3C56", + ANSI256: "4", + ANSI: "4", + }, + Dark: lipgloss.CompleteColor{ + TrueColor: "#E6EAF6", + ANSI256: "15", + ANSI: "15", + }, +} var reportsGradeToScorePercentageMap = map[string][2]int{ "A": {90, 100}, @@ -85,7 +151,7 @@ func StyleForScore(score int) lipgloss.Style { color = ReportsSvgColorBoundaryFallbackColor } - return lipgloss.NewStyle().Foreground(lipgloss.Color(color)) + return lipgloss.NewStyle().Foreground(color) } // Define a map for grade to score percentage range @@ -96,5 +162,5 @@ func StyleForGrade(grade string) lipgloss.Style { color = ReportsSvgColorBoundaryFallbackColor } - return lipgloss.NewStyle().Foreground(lipgloss.Color(color)) + return lipgloss.NewStyle().Foreground(color) } diff --git a/pkg/views/insights.go b/pkg/views/insights.go index 3710490..d2da0e9 100644 --- a/pkg/views/insights.go +++ b/pkg/views/insights.go @@ -51,9 +51,8 @@ func ShowInsightsDetails(apiResponse *types.ApiResponse) { } func ShowInsightsTechnologyDiscovery(apiResponse *types.ApiResponse) { - pterm.DefaultSection.WithLevel(2).Println("Technologies Discovered") - testData := pterm.TableData{{"Technology Name"}} + testData := pterm.TableData{{"Technologies Discovered"}} for _, technology := range apiResponse.Report.Technologies { row := []string{ styles.Title.Render(technology.Name), @@ -138,8 +137,6 @@ func NewInsightsDesignView(apiResponse *types.ApiResponse) { pterm.DefaultTable.WithHasHeader().WithBoxed().WithData(tableData).Render() - pterm.DefaultSection.WithLevel(2).Println("Design Tests") - testData := pterm.TableData{{"Test Title", "Status"}} for _, test := range category.Tests { row := []string{ @@ -169,8 +166,6 @@ func NewInsightsSecurityView(apiResponse *types.ApiResponse) { pterm.DefaultTable.WithHasHeader().WithBoxed().WithData(tableData).Render() - pterm.DefaultSection.WithLevel(2).Println("Security Tests") - testData := pterm.TableData{{"Test Title", "Status"}} for _, test := range category.Tests { row := []string{