# Save/restore system attribute

**URL:** <https://discourse.processing.org/t/save-restore-system-attribute/11364>\
**Category:** Beginners\
**Created:** [May 18, 2019, 5:02pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364 "2019-05-18T17:02:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![timdoodle](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@timdoodle](https://discourse.processing.org/u/timdoodle)\
**Post date:** [May 18, 2019, 5:02pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364/1 "2019-05-18T17:02:33Z")

</div>

I see how to set the values for many system attributes, but I don’t see how to obtain the current value of a system attribute. For example, one can set the color to fill shapes via fill(), but how does one determine the current fill value? I would like to be able to save and restore system attributes, so that I can temporarily change them. For example:

fill(specialColor);  
// Draw something  
drawComplexFigure(); // Changes the fill color several times (saves/restores current fill value)  
// draw something using value of fill before call to drawComplexFigure.

My example is specific to fill, but I would like to be able to do this for all system attributes (font, stroke, textSize, textAlign, rectMode, etc).

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 18, 2019, 5:10pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364/2 "2019-05-18T17:10:51Z")

</div>

[https://www.processing.org/reference/pushStyle\_.html](https://www.processing.org/reference/pushStyle_.html)

---

<div class="post-metadata">

**Author:** ![timdoodle](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@timdoodle](https://discourse.processing.org/u/timdoodle)\
**Post date:** [May 19, 2019, 2:36pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364/3 "2019-05-19T14:36:34Z")

</div>

Thx. Exactly what I needed to find.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 19, 2019, 5:39pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364/4 "2019-05-19T17:39:50Z")

</div>

Welcome to the forum!

Chrisir

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 21, 2019, 2:22pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364/5 "2019-05-21T14:22:42Z")

</div>

Note that pushMatrix / popMatrix works in the same way for transformations like translate, rotate, scale etc.

[https://processing.org/reference/pushMatrix\_.html](https://processing.org/reference/pushMatrix_.html)

If you are working with a mix of styles and transformation operations, in recent versions of Processing you can also use push / pop to manage combinations of matrix and style.

[https://processing.org/reference/push\_.html](https://processing.org/reference/push_.html)

---

<div class="post-metadata">

**Author:** ![timdoodle](https://avatars.discourse-cdn.com/v4/letter/t/278dde/32.png) [@timdoodle](https://discourse.processing.org/u/timdoodle)\
**Post date:** [May 22, 2019, 12:24pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364/6 "2019-05-22T12:24:02Z")

</div>

Thx. That’s good to know, too.
