mirror of
				https://github.com/KevinMidboe/motdGOi.git
				synced 2025-10-29 17:50:24 +00:00 
			
		
		
		
	commenting
This commit is contained in:
		
							
								
								
									
										3
									
								
								char.go
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								char.go
									
									
									
									
									
								
							| @@ -6,6 +6,7 @@ import ( | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // Represents a single ascii character | ||||
| type AsciiChar struct { | ||||
| 	// Slice with the lines of the Char | ||||
| 	Lines []string | ||||
| @@ -13,6 +14,7 @@ type AsciiChar struct { | ||||
| 	Color color.Attribute | ||||
| } | ||||
|  | ||||
| // Creates a new ascii character | ||||
| func NewAsciiChar(font *font, char rune) (*AsciiChar, error) { | ||||
| 	// If not ascii, throw an error | ||||
| 	if char < 0 || char > 127 { | ||||
| @@ -24,6 +26,7 @@ func NewAsciiChar(font *font, char rune) (*AsciiChar, error) { | ||||
|  | ||||
| 	lines := make([]string, height) | ||||
|  | ||||
| 	// Get the char lines of the char | ||||
| 	for i := 0; i < height; i++ { | ||||
| 		row := font.fontSlice[beginRow+i] | ||||
| 		row = strings.Replace(row, "@", "", -1) | ||||
|   | ||||
| @@ -97,7 +97,6 @@ func getColorSlice(colorStr string) []color.Attribute { | ||||
| 	} | ||||
|  | ||||
| 	return colors | ||||
|  | ||||
| } | ||||
|  | ||||
| // Validate if all required options are given | ||||
|   | ||||
| @@ -49,7 +49,7 @@ func (ar *AsciiRender) Render(str string) (string, error) { | ||||
| // Can be called from the user (if options wished) or the above Render method | ||||
| // Contains the whole rendering logic | ||||
| func (ar *AsciiRender) RenderOpts(str string, opt *RenderOptions) (string, error) { | ||||
|  | ||||
| 	// Should the text be colored | ||||
| 	colored := len(opt.FontColor) > 0 | ||||
|  | ||||
| 	// Load the font | ||||
|   | ||||
		Reference in New Issue
	
	Block a user