<commit_before>-- Copyright © 2012 <NAME> <<EMAIL>>
-- Licensed under the MIT license.

module Cover
where

import qualified Data.ByteString.Lazy as BS
import Data.Int
import Graphics.Rendering.Cairo
import Graphics.Rendering.Pango
import System.IO
import System.IO.Temp

makeCover :: String -> String -> String -> Int64 -> IO BS.ByteString
makeCover infoUnique infoTitle infoAuthor textSize = do

  let
    -- The color of the background is based on how long the story is.
    color = (1/4) + (3/4) * log (fromIntegral textSize) / log (10^9)

    -- This is the size of an A5 sheet in mm.
    width  = 148
    height = 210

    -- Density of image.
    pixelPerMM = 5

    widthPoints  = fromIntegral width  * 2.8346457
    heightPoints = fromIntegral height * 2.8346457

    -- Remaining units are in points.<commit_msg>Cover colors should be on a steeper curve.<commit_after>-- Copyright © 2012 <NAME> <<EMAIL>>
-- Licensed under the MIT license.

module Cover
where

import qualified Data.ByteString.Lazy as BS
import Data.Int
import Graphics.Rendering.Cairo
import Graphics.Rendering.Pango
import System.IO
import System.IO.Temp

makeCover :: String -> String -> String -> Int64 -> IO BS.ByteString
makeCover infoUnique infoTitle infoAuthor textSize = do

  let
    -- The color of the background is based on how long the story is.
    color = log (fromIntegral textSize) / log (10^9)

    -- This is the size of an A5 sheet in mm.
    width  = 148
    height = 210

    -- Density of image.
    pixelPerMM = 5

    widthPoints  = fromIntegral width  * 2.8346457
    heightPoints = fromIntegral height * 2.8346457

    -- Remaining units are in points.
{'fraction_non_alphanumeric': 0.08388654194327097, 'fraction_numerical': 0.04224502112251056, 'mean_word_length': 2.9760191846522783, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7004877', 'n_tokens_mistral': 552, 'n_tokens_neox': 493, 'n_words': 196}