# material

Python reference for `nagasim.appearance.material`. Provisional: it may change between minor versions, see [Appearance](../../appearance.md).

`nagasim.appearance.material`

```python
material(field: str, value: str)
```

The material that one look value paints, as the reference drawing draws it.

What each field paints:

- `frame_color`: the rails, end plates, legs, guide posts and panel guides. A colour
  `#RRGGBB` is always paint (metallic 0.15), even `#5E646B`, the colour of `steel`: only the
  name `steel` draws the frame as bare metal.
- `belt_kind`: the belt bed, pulley and end plates (a belt only).
- `roller_finish`: the roller tubes.
- `guide_style`: the round and flat guide rails. A panel guide is drawn in the frame's
  material, so call `guide_material()` for a guide; `MATERIALS["guide_style"]["panel"]` is
  only a placeholder.

`POST_CAP` is the cap on top of each guide post, whatever the look. Colours are sRGB
`#RRGGBB`; a glTF base colour is `linear_rgb(srgb(m.color))`.

Parameters
----------
field : str
    `frame_color`, `belt_kind`, `roller_finish` or `guide_style`.
value : str
    One of that field's names (`MATERIALS[field]`), or for `frame_color` a colour `#RRGGBB`.

Returns
-------
Material
    Its colour, metallic and roughness.

Raises
------
ValueError
    When *field* is not one of the four, or *value* is not one of its values; the message
    names the values it takes.

See Also
--------
nagasim.appearance.guide_material : The material of a side guide, panel included.
nagasim.appearance.look_of : The look values of one piece.

Examples
--------
>>> from nagasim.appearance import material
>>> material("frame_color", "blue")
Material(color='#1F4C9E', metallic=0.15, roughness=0.42)
>>> material("frame_color", "#5E646B").metallic
0.15
