\NeedsTeXFormat{LaTeX2e}

%%% Programmation

\RequirePackage{minted}
%\usemintedstyle[python]{perldoc}
\usemintedstyle[python]{carnot}
\usemintedstyle[ocaml]{tango}
\usemintedstyle[bash]{friendly}
\usemintedstyle[sql]{manni}
\tcbuselibrary{minted}

\definecolor{backgroundcolor}{rgb}{0.98,0.98,0.98}
\definecolor{titlecolor}{rgb}{1,1,1}
\definecolor{framecolor}{rgb}{0.45,0.45,0.45}
\definecolor{backgroundtitlecolor}{rgb}{0.45,0.45,0.45}

%%% Caml

\newtcblisting{caml}[1][]{%
  title=\ocamlname,
  coltitle=titlecolor,
  colback=backgroundcolor,
  colbacktitle=backgroundtitlecolor,
  colframe=framecolor,
  listing only,
  before skip=\topsep,
  minted options={%
    fontsize=\small,
    breaklines,
    mathescape,
  },
  minted language=ocaml,
  #1
}

\newcommand{\ca}[1]{\mintinline[breaklines]{ocaml}{#1}}
\newcommand{\canb}[1]{\mintinline{ocaml}{#1}}

%%% Python

\newtcblisting{python}[1][]{%
  title=\pythonname,
  coltitle=titlecolor,
  colback=backgroundcolor,
  colbacktitle=backgroundtitlecolor,
  colframe=framecolor,
  listing only,
  before skip=\topsep,
  minted options={%
    fontsize=\small,
    breaklines,
    mathescape,
  },
  minted language=python,
  #1
}

\newtcblisting{pythonlines}[1][]{%
  title=\pythonname,
  coltitle=titlecolor,
  colback=backgroundcolor,
  colbacktitle=backgroundtitlecolor,
  colframe=framecolor,
  listing only,
  before skip=\topsep,
  minted options={%
    fontsize=\small,
    breaklines,
    mathescape,
    linenos,
    numbersep=5pt,
  },
  minted language=python,
  #1
}

\newtcblisting{pyt}[1][]{%
  colback=backgroundcolor,
  colframe=framecolor,
  listing only,
  boxrule=0.1pt,
  before skip=\topsep,
  minted options={%
    fontsize=\small,
    breaklines,
    mathescape,
  },
  minted language=python,
  #1
}

\newcommand{\py}[1]{\mintinline[breaklines]{python}{#1}}
\newcommand{\nbpy}[1]{\mintinline{python}{#1}}

%%% Bash

\newtcblisting{bash}[1][]{%
  colback=backgroundcolor,
  listing only,
  before skip=\topsep,
  minted options={%
    fontsize=\small,
    breaklines
  },
  minted language=bash,
  #1
}

\newcommand{\ba}[1]{\mintinline[breaklines]{bash}{#1}}

%% SQL

\newtcblisting{sql}[1][]{%
  title=\sqlname,
  coltitle=titlecolor,
  colback=backgroundcolor,
  colbacktitle=backgroundtitlecolor,
  colframe=framecolor,
  listing only,
  before skip=\topsep,
  minted options={%
    fontsize=\small,
    breaklines,
    mathescape,
  },
  minted language=sql,
  #1
}

\newcommand{\sq}[1]{\mintinline[breaklines]{sql}{#1}}
\newcommand{\sqnb}[1]{\mintinline{sql}{#1}}

