pre-commit hook does not respect `--from-ref` / `--to-ref`
When running darker through `pre-commit`, it ignores the `--from-ref` and `--to-ref` arguments.

These 2 commands should behave the same.
```
pre-commit run darker --from-ref HEAD~1 --to-ref HEAD
darker --revision HEAD~1..HEAD
```

The pre-commit arguments are exposed via the environment variables `PRE_COMMIT_FROM_REF` and `PRE_COMMIT_TO_REF`
diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml
index 8930d94..764295a 100644
--- a/.pre-commit-hooks.yaml
+++ b/.pre-commit-hooks.yaml
@@ -1,7 +1,7 @@
 - id: darker
   name: darker
   description: "Black reformatting to Python files only in regions changed since last commit"
-  entry: darker
+  entry: "darker -r :PRE-COMMIT:"
   language: python
   language_version: python3
   require_serial: true
diff --git a/CHANGES.rst b/CHANGES.rst
index 81dd5b1..aa8e091 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,6 +5,9 @@ These features will be included in the next release:
 
 Added
 -----
+- Get revision range from pre-commit_'s ``PRE_COMMIT_FROM_REF`` and
+  ``PRE_COMMIT_TO_REF`` environment variables when using the ``--revision :PRE-COMMIT:``
+  option
 - Configure a pre-commit hook for Darker itself
 
 Fixed
diff --git a/README.rst b/README.rst
index e5facf7..44b0b0a 100644
--- a/README.rst
+++ b/README.rst
@@ -205,11 +205,13 @@ The following `command line arguments`_ can also be used to modify the defaults:
 .. code-block:: shell
 
      -r REVISION, --revision REVISION
-                           Git revision against which to compare the working
-                           tree. Tags, branch names, commit hashes, and other
-                           expressions like HEAD~5 work here. Also a range like
-                           master...HEAD or master... can be used to compare the
-                           best common ancestor.
+                           Git revision against which to compare the working tree.
+                           Tags, branch names, commit hashes, and other expressions
+                           like HEAD~5 work here. Also a range like master...HEAD or
+                           master... can be used to compare the best common ancestor.
+                           With the magic value :PRE-COMMIT:, Darker expects the
+                           revision range from the PRE_COMMIT_FROM_REF and
+                           PRE_COMMIT_TO_REF environment variables.
 
      --diff                Don't write the files back, just output a diff for
                            each file on stdout. Highlight syntax on screen if
@@ -272,6 +274,8 @@ For example:
 - commit ranges in ``-r`` / ``--revision``.
 - a ``[tool.darker]`` section in ``pyproject.toml``.
 
+*New in version 1.2.2:* Support for ``-r :PRE-COMMIT:`` / ``--revision=:PRE_COMMIT:``
+
 .. _Black documentation about pyproject.toml: https://black.readthedocs.io/en/stable/pyproject_toml.html
 .. _isort documentation about config files: https://timothycrosley.github.io/isort/docs/configuration/config_files/
 .. _command line arguments: https://black.readthedocs.io/en/stable/installation_and_usage.html#command-line-options
@@ -418,7 +422,7 @@ do the following:
 1. Append to the created ``.pre-commit-config.yaml`` the following lines::
 
        -   repo: https://github.com/akaihola/darker
-           rev: 1.2.1
+           rev: 1.2.2
            hooks:
            -   id: darker
 
diff --git a/src/darker/command_line.py b/src/darker/command_line.py
index 4f59878..c21eb63 100644
--- a/src/darker/command_line.py
+++ b/src/darker/command_line.py
@@ -51,7 +51,9 @@ def make_argument_parser(require_src: bool) -> ArgumentParser:
             "Git revision against which to compare the working tree. Tags, branch"
             " names, commit hashes, and other expressions like HEAD~5 work here. Also"
             " a range like master...HEAD or master... can be used to compare the best"
-            " common ancestor."
+            " common ancestor. With the magic value :PRE-COMMIT:, Darker expects the"
+            " revision range from the PRE_COMMIT_FROM_REF and PRE_COMMIT_TO_REF"
+            " environment variables."
         ),
     )
     isort_help = ["Also sort imports using the `isort` package"]
diff --git a/src/darker/git.py b/src/darker/git.py
index 17bd040..bfb1500 100644
--- a/src/darker/git.py
+++ b/src/darker/git.py
@@ -1,6 +1,7 @@
 """Helpers for listing modified files and getting unmodified content from Git"""
 
 import logging
+import os
 import re
 import sys
 from dataclasses import dataclass
@@ -22,8 +23,11 @@ COMMIT_RANGE_RE = re.compile(r"(.*?)(\.{2,3})(.*)$")
 
 
 # A colon is an invalid character in tag/branch names. Use that in the special value for
-# denoting the working tree as one of the "revisions" in revision ranges.
+# - denoting the working tree as one of the "revisions" in revision ranges
+# - referring to the `PRE_COMMIT_FROM_REF` and `PRE_COMMIT_TO_REF` environment variables
+#   for determining the revision range
 WORKTREE = ":WORKTREE:"
+PRE_COMMIT_FROM_TO_REFS = ":PRE-COMMIT:"
 
 
 def git_get_content_at_revision(path: Path, revision: str, cwd: Path) -> List[str]:
@@ -89,6 +93,20 @@ class RevisionRange:
         RevisionRange(rev1='a', rev2=':WORKTREE:', use_common_ancestor=True)
 
         """
+        if revision_range == PRE_COMMIT_FROM_TO_REFS:
+            try:
+                return cls(
+                    os.environ["PRE_COMMIT_FROM_REF"],
+                    os.environ["PRE_COMMIT_TO_REF"],
+                    use_common_ancestor=True,
+                )
+            except KeyError:
+                logger.error(
+                    "The environment variables PRE_COMMIT_FROM_REF and"
+                    " PRE_COMMIT_TO_REF must be defined when using -r / --revision"
+                    " :PRE-COMMIT:"
+                )
+                sys.exit(123)
         match = COMMIT_RANGE_RE.match(revision_range)
         if match:
             rev1, range_dots, rev2 = match.groups()
diff --git a/src/darker/tests/test_git.py b/src/darker/tests/test_git.py
index 49801cf..c8984cd 100644
--- a/src/darker/tests/test_git.py
+++ b/src/darker/tests/test_git.py
@@ -2,6 +2,7 @@
 
 # pylint: disable=redefined-outer-name
 
+import os
 from pathlib import Path
 from unittest.mock import patch
 
@@ -15,6 +16,7 @@ from darker.git import (
     should_reformat_file,
 )
 from darker.tests.conftest import GitRepoFixture
+from darker.tests.helpers import raises_if_exception
 
 
 @pytest.mark.parametrize(
@@ -271,6 +273,27 @@ def test_git_get_modified_files_revision_range(
     assert {path.name for path in result} == expect
 
 
+@pytest.mark.parametrize(
+    "environ, expect",
+    [
+        ({}, SystemExit),
+        ({"PRE_COMMIT_FROM_REF": "old"}, SystemExit),
+        ({"PRE_COMMIT_TO_REF": "new"}, SystemExit),
+        ({"PRE_COMMIT_FROM_REF": "old", "PRE_COMMIT_TO_REF": "new"}, ["old", "new"]),
+    ],
+)
+def test_revisionrange_parse_pre_commit(environ, expect):
+    """RevisionRange.parse(':PRE-COMMIT:') gets the range from environment variables"""
+    with patch.dict(os.environ, environ), raises_if_exception(expect):
+
+        result = RevisionRange.parse(":PRE-COMMIT:")
+
+        expect_rev1, expect_rev2 = expect
+        assert result.rev1 == expect_rev1
+        assert result.rev2 == expect_rev2
+        assert result.use_common_ancestor
+
+
 edited_linenums_differ_cases = pytest.mark.parametrize(
     "context_lines, expect",
     [
['src/darker/git.py', '.pre-commit-hooks.yaml', 'README.rst', 'CHANGES.rst', 'src/darker/tests/test_git.py', 'src/darker/command_line.py']