fix: add dirty hack to avoid white background.
This commit is contained in:
		
							parent
							
								
									a22809f00e
								
							
						
					
					
						commit
						845e87b521
					
				
							
								
								
									
										14
									
								
								main.go
								
								
								
								
							
							
						
						
									
										14
									
								
								main.go
								
								
								
								
							| 
						 | 
				
			
			@ -73,10 +73,22 @@ func highlight(w io.Writer, source, lexer, style string) error {
 | 
			
		|||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    /* HACK: If background color is white, set to a reasonable, light grey
 | 
			
		||||
     * default. */
 | 
			
		||||
    if s.Get(chroma.Background).Background.String() == "#ffffff" {
 | 
			
		||||
        senr := s.Get(chroma.Background)
 | 
			
		||||
        senr.Background = chroma.ParseColour("#f6f8fa");
 | 
			
		||||
        s, err = s.Builder().AddEntry(chroma.Background, senr).Build();
 | 
			
		||||
        if err != nil {
 | 
			
		||||
            return err
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	return f.Format(w, s, it)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const Version = "0.1"
 | 
			
		||||
const Version = "0.1.2"
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	css := flag.String("css", "", "Path to a CSS import to include at the beginning of the output")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue