| 7 | ) |
| 8 | |
| 9 | func main() { |
| 10 | // Print an informational message about the default theme styles. |
| 11 | pterm.Info.Println("These are the default theme styles.\nYou can modify them easily to your personal preference,\nor create new themes from scratch :)") |
| 12 | |
| 13 | // Print a blank line for better readability. |
| 14 | pterm.Println() |
| 15 | |
| 16 | // Get the value and type of the default theme. |
| 17 | v := reflect.ValueOf(pterm.ThemeDefault) |
| 18 | typeOfS := v.Type() |
| 19 | |
| 20 | // Check if the type of the default theme is 'pterm.Theme'. |
| 21 | if typeOfS == reflect.TypeOf(pterm.Theme{}) { |
| 22 | // Iterate over each field in the default theme. |
| 23 | for i := 0; i < v.NumField(); i++ { |
| 24 | // Try to convert the field to 'pterm.Style'. |
| 25 | field, ok := v.Field(i).Interface().(pterm.Style) |
| 26 | if ok { |
| 27 | // Print the field name using its own style. |
| 28 | field.Println(typeOfS.Field(i).Name) |
| 29 | } |
| 30 | // Pause for a quarter of a second to make the output easier to read. |
| 31 | time.Sleep(time.Millisecond * 250) |
| 32 | } |
| 33 | } |
| 34 | } |