"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/outhtml_add_shadow.lua" (12 May 2020, 1260 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --[[
    2 Sample plugin file for highlight
    3 
    4 Adds a shadow and margin to the code box
    5 ]]
    6 
    7 Description="Adds a shadow and margin to the code box in HTML output (intended for bright themes)"
    8 
    9 Categories = {"format", "html" }
   10 
   11 
   12 -- function to update theme definition
   13 -- optional parameter: theme description
   14 function themeUpdate()
   15 
   16   function lighten(colour)
   17     if string.match(colour, "#%x+")==nil then
   18       return "#ffffff"
   19     end
   20     rr=50 + ("0x"..string.match(colour, "%x%x", 2))
   21     gg=50 + ("0x"..string.match(colour, "%x%x", 4))
   22     bb=50 + ("0x"..string.match(colour, "%x%x", 6))
   23     if (rr>255) then rr = 255 end
   24     if (gg>255) then gg = 255 end
   25     if (bb>255) then bb = 255 end
   26     return string.format("#%02x%02x%02x", rr, gg, bb)
   27   end
   28 
   29   if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   30     Injections[#Injections+1]="pre.hl, ol.hl { margin:2em; box-shadow:10px 10px 0.5em "..lighten(Default.Colour).."; border: 1px solid "..lighten(Default.Colour)..";}"
   31     Injections[#Injections+1]="pre.hl {padding:1em;}"
   32     Injections[#Injections+1]="ol.hl {padding:1em 1em 1em 4em;}"
   33     Injections[#Injections+1]="body.hl { background-color:"..lighten(Canvas.Colour).."; }"
   34   end
   35 
   36 end
   37 
   38 Plugins={
   39 
   40   { Type="theme", Chunk=themeUpdate }
   41 
   42 }