A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 2 години
преди 3 години
преди 2 години
преди 3 години
преди 2 години
преди 3 години
преди 3 години
преди 2 години
преди 3 години
преди 2 години
преди 3 години
преди 2 години
преди 3 години
преди 2 години
преди 3 години
преди 3 години
преди 3 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the `title` element
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>Against alcohol (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f7f7f7">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
  26. <meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
  27. <!-- Documented, feel free to shoot an email. -->
  28. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  29. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  36. <script>
  37. function toggleTheme(themeName) {
  38. document.documentElement.classList.toggle(
  39. 'forced-dark',
  40. themeName === 'dark'
  41. )
  42. document.documentElement.classList.toggle(
  43. 'forced-light',
  44. themeName === 'light'
  45. )
  46. }
  47. const selectedTheme = localStorage.getItem('theme')
  48. if (selectedTheme !== 'undefined') {
  49. toggleTheme(selectedTheme)
  50. }
  51. </script>
  52. <meta name="robots" content="noindex, nofollow">
  53. <meta content="origin-when-cross-origin" name="referrer">
  54. <!-- Canonical URL for SEO purposes -->
  55. <link rel="canonical" href="https://fergus-mccullough.com/index.php/2021/04/09/against-alcohol/">
  56. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">
  57. <article>
  58. <header>
  59. <h1>Against alcohol</h1>
  60. </header>
  61. <nav>
  62. <p class="center">
  63. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  64. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  65. </svg> Accueil</a> •
  66. <a href="https://fergus-mccullough.com/index.php/2021/04/09/against-alcohol/" title="Lien vers le contenu original">Source originale</a>
  67. </p>
  68. </nav>
  69. <hr>
  70. <p><em>A review of <a href="https://www.amazon.co.uk/Drink-Science-Alcohol-Your-Health-ebook/dp/B07SZLPS5B/">Drink?: The New Science of Alcohol and Your Health</a> by Professor David Nutt, with comments</em>.</p>
  71. <p><em>N.B. all statistics are from the book unless otherwise indicated. The book mainly concerned itself with the United Kingdom, but I think the lessons are broadly applicable to other Western countries too.</em></p>
  72. <p>This useful little book provides a summary of the latest science on the impact of alcohol, which I’ll briefly outline, and goes on to suggest some actions in light of that knowledge.</p>
  73. <p>The overriding impression I got during the book was that alcohol is Really Bad for your health:</p>
  74. <blockquote class="wp-block-quote"><p>Alcohol use is one of the top five causes of disease and disability in almost all countries in Europe. In the UK, alcohol is now the leading cause of death in men between the ages of 16 and 54 years, accounting for over 20 per cent of the total. More than three- quarters of liver cirrhosis deaths, 7 per cent of cancer deaths and 25 per cent of injury deaths in adults under 65 years of age in Europe in 2004 were estimated to be due to alcohol.1 According to the government, alcohol is the third leading risk factor for death and disability after smoking and obesity. That’s a pretty scary list, right?”</p></blockquote>
  75. <p>At least one in five cases of dementia is caused by alcohol (although there is a study that contradicts this). It can also exacerbate mental health problems, especially anxiety and depression. One major American study suggested that up to a quarter of young alcoholics have social anxiety disorder.</p>
  76. <p>This isn’t a big surprise, of course. What I didn’t realise before, though, is how poorly evidenced the beneficial effects of alcohol are. Looking at the available studies, Nutt writes that the positive effect on cardiovascular health has never been definitely proven (i.e. beyond mere association), and even if there is a partial effect, the optimal level of consumption would be around one unit a day. And the benefits don’t outweigh all the other risks, which include cancer.</p>
  77. <p>The impact of alcohol on my country, the UK, is pretty significant. 10.8m Brits drink at levels posing some risk to their health, and 1.6m ‘may have some level of alcohol dependence’. Different figures, from the NHS, suggest around 9% of men and 3% of women show such signs (which my back of the envelope calculations suggest would be something like 3.3m people in total). <em>[Edit: I amended this paragraph to show these are two different surveys that don’t agree with each other. Sorry for originally implying they were the same survey.]</em></p>
  78. <p>It’s estimated that alcohol contributes to 30,000 deaths a year in England, Scotland and Wales. And it’s thought to cause 5% of the global disease burden.</p>
  79. <p>There is enough evidence here to make a strong case against alcohol on a number of grounds (which Nutt himself does not quite do).</p>
  80. <p>Alcohol is a drain on economic growth, damaging our productivity and forcing us to spend money on healthcare that could be used elsewhere. The CDC estimated the cost of hangovers to the American economy as $249bn in 2010. The Institute of Alcohol Studies estimates a cost of £1.4bn a year for British productivity. (The charity Alcohol Change UK puts the productivity damage at <a href="https://alcoholchange.org.uk/alcohol-facts/fact-sheets/alcohol-in-the-workplace">£7bn a year</a> instead. I haven’t tried to understand why those figures are so different.)  If you think economic growth is <a href="https://www.amazon.co.uk/Stubborn-Attachments-Prosperous-Responsible-Individuals/dp/1732265135/">important</a>, then alcohol is not worth the hassle.</p>
  81. <p>Treating the results of excess alcohol consumption is a huge burden for the NHS, which is under increasing strain as the population ages. In 2017/18, 338,000 hospital admissions were mainly attributable to alcohol, and 23% of those were due to accidents.</p>
  82. <p>It’s a little strange that this isn’t talked about more. Over the past twelve months we’ve seen an outpouring of public support for the NHS, and polls suggest that it’s the one institution that almost everyone in Britain cares about. So why not ease the burden on its workers (and the public purse) by reducing our alcohol consumption?</p>
  83. <p>Alcohol fuels violence: victims thought offenders were under the influence of alcohol 40% of all violent crimes in 2016/17  — that’s half a million incidents. (It’s hard to know how accurate this figure is, but even if it was only 20% of the total, that’s a lot of crimes. And we can be pretty confident some crimes are not reported.)</p>
  84. <p>Those figures include sexual violence. Alcohol is the most common date rape drug, involved in 46% of cases studied by a London toxicology lab, while drugs only featured in 33% and sedative drugs in just 2%.</p>
  85. <blockquote class="wp-block-quote"><p>One in three women have been sexually taken advantage of while under the influence of drugs or alcohol, mostly in private homes by someone they know, according to the 2019 Global Drug Survey. Nearly 90 per cent of these cases involved alcohol.”</p></blockquote>
  86. <p>As Nutt makes clear, ‘this is not to put any blame on the women — of course these crimes should not happen.’</p>
  87. <p>This is, then, the case against alcohol — it undermines our health and our economy. It contributes to violence, including sexual violence. It’s an addictive drug that ensnares too many people in society.</p>
  88. <hr class="wp-block-separator">
  89. <p>The evidence here is so damning that I almost wonder whether Nutt is being <a href="https://www.reddit.com/r/explainlikeimfive/comments/60823b/eli5what_does_tyler_cowen_mean_when_he_says/">Straussian</a> when he suggests that we should still drink (within limits). Some of the arguments he makes in favour of alcohol are almost ridiculous:</p>
  90. <blockquote class="wp-block-quote"><p>A glass to hold gives us something to do with our hands in awkward situations, particularly now smoking has become so vilified.”</p></blockquote>
  91. <p>I’m taking him out of context, but only a bit. He adds in the next sentence that food and socialising, which regularly go hand-in-hand with alcohol, are good things. I agree. But there’s no reason that you can’t drink something non-alcoholic while you enjoy dinner and company. If you really want to hold a glass, it doesn’t have to contain a liquid that is harmful to your health and wider society.</p>
  92. <p>Alcohol is important for rituals, he points out:</p>
  93. <blockquote class="wp-block-quote"><p>Nearly all of our celebration rituals revolve around alcohol, from the cradle to the grave. We wet the baby’s head, we toast exam results and birthdays, we crack open the fizz at both wedding breakfasts and divorce parties. And we say goodbye to our loved ones with alcohol at a funeral wake (and drown our sorrows too). When you are working out how much to drink – or not drink – you may want to factor in the social benefits you get from it.”</p></blockquote>
  94. <p>Left unaddressed is why we think that alcohol is necessary to any of those (good and often great) <a href="https://www.nytimes.com/2019/04/22/opinion/rituals-meaning.html">rituals</a>. It’s not. I don’t see why you can’t get most of those social benefits anyway.</p>
  95. <p>It will be very tough to change those cultural norms, although, as Nutt notes, an increasing number of young people are eschewing alcohol altogether. This trend seems to be linked to a greater focus on health and ‘wellness’, although it may also be because people are taking other drugs instead.</p>
  96. <p>The other reason that nothing is done about alcohol is the drinks industry. In chapter 11, Nutt relates a sad tale of a cabinet office committee under Blair that proposed new policies to tackle alcohol addiction, but was scuppered by a drinks industry lobbying effort. This is not a surprise:</p>
  97. <blockquote class="wp-block-quote"><p>Despite repeating their message of ‘sensible drinking’ at every opportunity, the drinks industry wants you to keep drinking. That is its reason for existing. One estimate is that, if everyone drank within recommended limits, the industry would lose £13 billion. That’s a lot of lost profit. Its aim is often aided by the government, which wants the tax income.”</p></blockquote>
  98. <p>The government is pretty much in the pocket of this industry, with gifts to MPs in the ‘All-Party Parliamentary Beer Group’ every year and the perceived importance of the tax revenue from alcohol. There is something disgusting about MPs receiving gifts like that while alcohol causes so much harm in society. And they are being shortsighted, fiscally:</p>
  99. <blockquote class="wp-block-quote"><p>…in fact, it’s been estimated that when you add in the costs of alcohol to society, there is a net loss to the Exchequer . This is undeniably a difficult argument to disentangle economically, and a complicated sum. But the costs of alcohol to society are relatively well established. These are: £3.5bn on health, especially hospital admissions and accident and emergency attendances; £6.5bn for policing drunkenness; £20bn for lost productivity through hangovers. The total is £30 billion.”</p></blockquote>
  100. <p>Nutt has his own set of policy solutions, and I think they’d be great: taxing drinks by the amount of alcohol in them and increase that tax back to 1950s levels (i.e. triple it); stop selling strong alcohol in supermarkets; make it a law that all alcohol outlets must sell non-alcoholic drinks; install breathalysers in pubs and stop drunk people from buying more alcohol; banning all alcohol advertising; and many more.</p>
  101. <p>He focuses most on minimum unit pricing (MUP). As the government has not raised its duty on alcohol, it now costs a third of what it did in 1970 in real terms. Nutt points to evidence that consumption goes down when prices go up. The duty paid in England varies wildly by the type of drink, rather than relating to the amount of alcohol in it, so it’s possible to get a lot of alcohol for little money.</p>
  102. <p>Scotland, however, introduced MUP in 2018 — with initially positive results:</p>
  103. <blockquote class="wp-block-quote"><p>Research from Newcastle University has shown that the amount of alcohol bought in shops and supermarkets per person per week fell by 1.2 units (just over half a pint of beer or a measure of spirits) compared with what would have been drunk without MUP. In England over the same time, consumption increased.18 The biggest drop – two units a week – was in the heaviest fifth of drinkers. This shows that the policy is having the biggest impact on exactly the people it needs to. The number of units bought per person per week in Scotland is still higher than in England, at 19 units, but it did start from a much higher level. The Welsh Assembly has now passed legislation for MUP . At the same time as MUP was introduced, Scotland made two other important policy changes for alcohol. It reduced the drink-driving limit (from 80mg% to 50mg%) and banned discounted alcohol such as bulk-buys in supermarkets and two-for-one offers in bars. All the evidence suggests that, together with MUP, these should result in a real cut in harms.”</p></blockquote>
  104. <p>Targeting the heaviest drinkers is important because they are the worst-affected; they contribute the vast majority of the health costs.</p>
  105. <p>France had an extremely high rate of liver cirrhosis in the 1980s as a result of alcohol consumption. They tackled this by focusing on advertising (banning the drinks industry from it, basically); health warnings on bottles (‘alcohol abuse is dangerous for health’); price (restrictions on ‘happy hours’ and somehow they pressured the wine industry to make higher quality wine); driving (reducing the blood alcohol content limit). </p>
  106. <p>The French wine industry has turned out to be more profitable following these changes, as it makes better quality wine now. But the UK hasn’t followed suit, says Nutt:</p>
  107. <blockquote class="wp-block-quote"><p>The UK drinks industry know this data. They know that if we went down the route of raising the price of alcohol, they would be more profitable over time. In my opinion, the reason they don’t is that making money in the short term is so easy. And they think that if they make any concessions in this direction, people will begin to question all our other beliefs around alcohol and health.”</p></blockquote>
  108. <p>Is this a case of companies prioritising short term economic performance over the long run? If Nutt is right, then presumably the drinks businesses must fear the consequences of a shaking out; perhaps each is worried that they wouldn’t survive the instability. If a law change is on the cards, then one can imagine some private equity </p>
  109. <p>Nutt also favours the <a href="https://en.wikipedia.org/wiki/Alcoholic_drinks_in_Sweden#Regulation_and_taxation">Swedish model</a>, in which only government shops are allowed to sell alcohol of more than 3.5% ABV (<a href="https://en.wikipedia.org/wiki/Alcohol_by_volume">Alcohol By Volume</a>). They are only open at certain times of the day, forcing you to plan before you drink:</p>
  110. <blockquote class="wp-block-quote"><p>This system has led to the Swedes drinking roughly three-quarters of what we drink per year in the UK. And to a rate of deaths from liver cirrhosis approximately half of ours. This shows, yet again, how small changes in consumption lead to bigger health gains.”</p></blockquote>
  111. <p>Not sure he really proves that these government run shops have this effect, but still, it seems like a sound policy.</p>
  112. <p>I was also struck by this story:</p>
  113. <blockquote class="wp-block-quote"><p>Public Health England wanted to do an advertising campaign promoting (at least) two drink-free days a week.38 This is sensible, safe and appropriate advice. But PHE doesn’t have much money for public advertising so they agreed to partner with Drinkaware, a charity that’s funded by the alcohol industry. Hundreds of academics signed a petition censoring PHE. And their senior alcohol advisor Ian Gilmore resigned in protest.39 It wasn’t the content of the campaign that was contentious, it was where the money was coming from. As a pragmatist, I don’t have a problem with industry funding independent research and education, providing they don’t get to have any influence on the content and outputs. But I can see why people do object. What is a shame is that the campaign didn’t happen because there was no other source of funding. In reality, people will die as a result of not knowing this useful information.”</p></blockquote>
  114. <p>It seems like the academics were failing to think at the margin here; the choice here was between a campaign and no campaign, and regardless of the source of funding, getting people to drink less would have been good. I can’t help but be reminded of mistakes made by those working on public health in 2020, where a failure to think on the margin and act fast led to worse public health outcomes.</p>
  115. <p>So alcohol is bad, too much alcohol is *really* bad, and we could go a significant distance to solving this problem if we could work out the political economy a bit better.</p>
  116. <p>But we can’t work out the political economy, at least for now. Unless there is a sudden national temperance movement, the drinks industry is a powerful lobbying force in the UK.</p>
  117. <p>Alcohol’s damaging impact on society remains, then. You could lobby your MP, and if enough people do that effectively then maybe the drinks industry would eventually be cowed.</p>
  118. <p>That seems a bit unsatisfactory, though. The book shows that so much of alcohol consumption is cultural; it’s just ‘the done thing’ to go out for an alcoholic drink or ten with your mates. If you have any experience in British society, then you will know this to be true.</p>
  119. <p>The winners in this equilibrium are people who, for one reason or another, can manage this situation well. They aren’t genetically predisposed to alcohol addiction; they are socially confident so don’t feel the need for Dutch courage or the need to show off by drinking too much; or, perhaps, they are successful or content in the different spheres of their life, so they don’t have pain that they want to numb. Some successful people are vulnerable too in a different way, being wined and dined if you’re an executive, or trying to climb a corporate ladder by getting drinks with whoever after work.</p>
  120. <p>It seems wrong that a privileged (!) class of people who can manage alcohol effectively in their lives do not try harder to make sure that the under-privileged, vulnerable members of society don’t end up addicted to this awful drug.</p>
  121. <p>It’s possible to consume alcohol in a safe manner, with risks to your long term health that you might consider acceptable if you enjoy drinking it. But at some margin, you are contributing to the idea that it’s normal to drink it. And we need to break down that norm.</p>
  122. <p>I don’t really enjoy drinking alcohol, frankly. I drink a little bit at some social occasions, but following my own argument here, I’m not really sure that I should. By properly abstaining, I could help to undermine the idea that alcohol is normal. And it wouldn’t be that much extra effort to do so.</p>
  123. <p>I don’t know what Nutt’s personal political or moral views are, but I can’t help but notice that modern liberalism has no real argument against people harming themselves and others with alcohol if that’s what they want to do. In the absence of a Christian or other religious framework, it’s quite difficult to argue that you <em>should</em> do anything about alcohol. Who can tell you what makes your life worthwhile?</p>
  124. <p>Take the increase in the minimum drinking age in America in the 1980s for example. The National Minimum Drinking Age Act is thought to have saved hundreds of thousands of young lives that would have been lost as a result of drink-driving. But Nutt doesn’t want to raise the minimum drinking age, despite this data:</p>
  125. <blockquote class="wp-block-quote"><p>If someone can vote, if they can join the army, fight and die, get married, then they should be allowed to buy alcohol.”</p></blockquote>
  126. <p>Granted, there is a certain logic here. Yet the same argument could be made about cocaine or heroin — you’re an adult, you can decide (Nutt, it seems has been willing to follow his logic to its conclusion for <a href="https://en.wikipedia.org/wiki/David_Nutt#%22Equasy%22">ecstasy</a>, at least from a ‘harm caused’ perspective). Those drugs are damaging for people and society, and I don’t think anyone has a ‘right’ to take them. But modern liberalism says that you are an autonomous person from age 18 who has no responsibilities to others, and thus provides limited moral arguments against drugs of any kind. If this moral framework is not available to British society anymore, then perhaps <a href="https://marginalrevolution.com/marginalrevolution/2017/08/im-mormons-one.html">individual teetotalism is the only way to go</a>. That way the norm of alcohol consumption can be undermined, one person at a time. </p>
  127. <p>A Christian framework can be extremely helpful here. The Bible is <a href="https://ca.thegospelcoalition.org/columns/ad-fontes/the-case-for-cautious-consumption/">not definitively teetotal</a> (for instance, Christ makes wine for the wedding at Cana in John 2:1-11). But abstention could be the right option for you, either for personal reasons or because of your <a href="https://web.archive.org/web/20060704174712/http://www.bpnews.net/bpcolumn.asp?ID=2298">convictions</a>. The Bible does, however, prohibit drunkenness (for example, see Ephesians 5:18), which leads to much worse health and social outcomes than light drinking. Crucially, there are no grounds for looking down on people who take a different path from you, as long as it is within these guardrails (see Romans 14:21 or a discussion <a href="https://www.thegospelcoalition.org/blogs/justin-taylor/alcohol-liberty-and-legalism/">here</a>).</p>
  128. <p>Alcohol occupies a sinister position in British society and culture. But there is a better way, with stricter rules and different norms. You don’t have to fully agree with my prescriptions here to wonder what a society with no alcohol problems would look like. Formerly wasted talent could be used in the economy, an invigorated health service could enjoy reduced waiting times, families and relationships could be healthier and less violent. If we want to get there, it’s worth talking more about the problem of alcohol.</p>
  129. </article>
  130. <hr>
  131. <footer>
  132. <p>
  133. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  134. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  135. </svg> Accueil</a> •
  136. <a href="/david/log/" title="Accès au flux RSS"><svg class="icon icon-rss2">
  137. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-rss2"></use>
  138. </svg> Suivre</a> •
  139. <a href="http://larlet.com" title="Go to my English profile" data-instant><svg class="icon icon-user-tie">
  140. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-user-tie"></use>
  141. </svg> Pro</a> •
  142. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"><svg class="icon icon-mail">
  143. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-mail"></use>
  144. </svg> Email</a> •
  145. <abbr class="nowrap" title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"><svg class="icon icon-hammer2">
  146. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-hammer2"></use>
  147. </svg> Légal</abbr>
  148. </p>
  149. <template id="theme-selector">
  150. <form>
  151. <fieldset>
  152. <legend><svg class="icon icon-brightness-contrast">
  153. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-brightness-contrast"></use>
  154. </svg> Thème</legend>
  155. <label>
  156. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  157. </label>
  158. <label>
  159. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  160. </label>
  161. <label>
  162. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  163. </label>
  164. </fieldset>
  165. </form>
  166. </template>
  167. </footer>
  168. <script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
  169. <script>
  170. function loadThemeForm(templateName) {
  171. const themeSelectorTemplate = document.querySelector(templateName)
  172. const form = themeSelectorTemplate.content.firstElementChild
  173. themeSelectorTemplate.replaceWith(form)
  174. form.addEventListener('change', (e) => {
  175. const chosenColorScheme = e.target.value
  176. localStorage.setItem('theme', chosenColorScheme)
  177. toggleTheme(chosenColorScheme)
  178. })
  179. const selectedTheme = localStorage.getItem('theme')
  180. if (selectedTheme && selectedTheme !== 'undefined') {
  181. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  182. }
  183. }
  184. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  185. window.addEventListener('load', () => {
  186. let hasDarkRules = false
  187. for (const styleSheet of Array.from(document.styleSheets)) {
  188. let mediaRules = []
  189. for (const cssRule of styleSheet.cssRules) {
  190. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  191. continue
  192. }
  193. // WARNING: Safari does not have/supports `conditionText`.
  194. if (cssRule.conditionText) {
  195. if (cssRule.conditionText !== prefersColorSchemeDark) {
  196. continue
  197. }
  198. } else {
  199. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  200. continue
  201. }
  202. }
  203. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  204. }
  205. // WARNING: do not try to insert a Rule to a styleSheet you are
  206. // currently iterating on, otherwise the browser will be stuck
  207. // in a infinite loop…
  208. for (const mediaRule of mediaRules) {
  209. styleSheet.insertRule(mediaRule.cssText)
  210. hasDarkRules = true
  211. }
  212. }
  213. if (hasDarkRules) {
  214. loadThemeForm('#theme-selector')
  215. }
  216. })
  217. </script>
  218. </body>
  219. </html>